Updated test project.

This commit is contained in:
2024-10-27 12:56:22 +01:00
parent 4157862de1
commit 86c22cfe85
9 changed files with 63 additions and 346 deletions

1
.gitignore vendored
View File

@@ -5,6 +5,7 @@ project.lock.json
.DS_Store .DS_Store
*.pyc *.pyc
nupkg/ nupkg/
.idea
# Visual Studio Code # Visual Studio Code
.vscode .vscode

View File

@@ -1,91 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{D5013B4E-8A1B-4DBB-8FB5-E09935F4F764}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DynamORM.Tests</RootNamespace>
<AssemblyName>DynamORM.Tests</AssemblyName>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;MONO</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;MONO</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="nunit.framework">
<Private>False</Private>
<Package>nunit</Package>
</Reference>
<Reference Include="Mono.Data.Sqlite" />
</ItemGroup>
<ItemGroup>
<Compile Include="Helpers\Dynamic\DynamicParserTests.cs" />
<Compile Include="Modify\DynamicModificationTests.cs" />
<Compile Include="Modify\DynamicNoSchemaModificationTests.cs" />
<Compile Include="Modify\DynamicTypeSchemaModificationTests.cs" />
<Compile Include="Modify\ParserTests.cs" />
<Compile Include="Select\DynamicNoSchemaAccessTests.cs" />
<Compile Include="Select\DynamicTypeSchemaAccessTests.cs" />
<Compile Include="Helpers\AttachToDebugger.cs" />
<Compile Include="Select\DynamicAccessTests.cs" />
<Compile Include="Helpers\Users.cs" />
<Compile Include="Helpers\UsersBareBoneClass.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Select\LegacyParserTests.cs" />
<Compile Include="Select\ParserTests.cs" />
<Compile Include="Select\RenamedTypedAccessTests.cs" />
<Compile Include="TestsBase.cs" />
<Compile Include="Select\TypedAccessTests.cs" />
<Compile Include="Helpers\PoolingTests.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DynamORM\DynamORM.csproj">
<Project>{63963ED7-9C78-4672-A4D4-339B6E825503}</Project>
<Name>DynamORM</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -1,138 +1,44 @@
<?xml version="1.0" encoding="utf-8"?> <Project Sdk="Microsoft.NET.Sdk">
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <TargetFramework>net8.0</TargetFramework>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Description>Dynamic Object-Relational Mapping tests library.</Description>
<ProductVersion>8.0.30703</ProductVersion> <Copyright>Copyright © RUSSEK Software 2012-2024</Copyright>
<SchemaVersion>2.0</SchemaVersion> <Company>RUSSEK Software</Company>
<ProjectGuid>{D5013B4E-8A1B-4DBB-8FB5-E09935F4F764}</ProjectGuid> <Authors>Grzegorz Russek</Authors>
<VersionPrefix>1.8</VersionPrefix>
<RepositoryUrl>https://git.dr4cul4.pl/RUSSEK-Software/DynamORM</RepositoryUrl>
<PackageProjectUrl>https://dr4cul4.pl</PackageProjectUrl>
<Product>DynamORM</Product>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder> <IsPackable>false</IsPackable>
<RootNamespace>DynamORM.Tests</RootNamespace> <ImplicitUsings>enable</ImplicitUsings>
<AssemblyName>DynamORM.Tests</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<NoStdLib>False</NoStdLib>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
<SignAssembly>False</SignAssembly>
<DelaySign>False</DelaySign>
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugType>Full</DebugType> <ItemGroup Condition="$(TargetFramework.StartsWith('net4')) AND '$(MSBuildRuntimeType)' == 'Core' AND '$(OS)' != 'Windows_NT'">
<Optimize>False</Optimize> <PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" PrivateAssets="All" />
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DebugSymbols>true</DebugSymbols>
<BaseAddress>4194304</BaseAddress>
<RegisterForComInterop>False</RegisterForComInterop>
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
<Prefer32Bit>False</Prefer32Bit>
<PlatformTarget>AnyCPU</PlatformTarget>
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>PdbOnly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<BaseAddress>4194304</BaseAddress>
<RegisterForComInterop>False</RegisterForComInterop>
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
<Prefer32Bit>False</Prefer32Bit>
<PlatformTarget>AnyCPU</PlatformTarget>
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' ">
<BaseAddress>4194304</BaseAddress>
<PlatformTarget>AnyCPU</PlatformTarget>
<RegisterForComInterop>False</RegisterForComInterop>
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
<Prefer32Bit>False</Prefer32Bit>
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Helpers\Dynamic\DynamicParserTests.cs" /> <ProjectReference Include="..\DynamORM\DynamORM.csproj" />
<Compile Include="Helpers\PoolingTests.cs" />
<Compile Include="Helpers\Validation\ObjectValidationTest.cs" />
<Compile Include="Modify\DynamicModificationTests.cs" />
<Compile Include="Modify\DynamicNoSchemaModificationTests.cs" />
<Compile Include="Modify\DynamicTypeSchemaModificationTests.cs" />
<Compile Include="Modify\ParserTests.cs" />
<Compile Include="Select\DynamicNoSchemaAccessTests.cs" />
<Compile Include="Select\DynamicTypeSchemaAccessTests.cs" />
<Compile Include="Helpers\AttachToDebugger.cs" />
<Compile Include="Select\DynamicAccessTests.cs" />
<Compile Include="Helpers\Users.cs" />
<Compile Include="Helpers\UsersBareBoneClass.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Select\LegacyParserTests.cs" />
<Compile Include="Select\ParserTests.cs" />
<Compile Include="TestsBase.cs" />
<Compile Include="Select\TypedAccessTests.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<EmbeddedResource Include="Properties\Resources.resx"> <PackageReference Include="coverlet.collector" Version="6.0.0"/>
<Generator>ResXFileCodeGenerator</Generator> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0"/>
<LastGenOutput>Resources.Designer.cs</LastGenOutput> <PackageReference Include="MSTest.TestAdapter" Version="3.1.1"/>
<SubType>Designer</SubType> <PackageReference Include="MSTest.TestFramework" Version="3.1.1"/>
</EmbeddedResource> <PackageReference Include="System.Data.SQLite" Version="1.0.119" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\DynamORM\DynamORM.csproj"> <EmbeddedResource Remove="Helpers\**" />
<Project>{63963ED7-9C78-4672-A4D4-339B6E825503}</Project> <EmbeddedResource Remove="Modify\**" />
<Name>DynamORM</Name>
</ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="MSTest.TestAdapter"> <None Remove="Helpers\**" />
<Version>3.3.1</Version> <None Remove="Modify\**" />
</PackageReference>
<PackageReference Include="MSTest.TestFramework">
<Version>3.3.1</Version>
</PackageReference>
<PackageReference Include="System.Data.SQLite">
<Version>1.0.118</Version>
</PackageReference>
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project> </Project>

View File

@@ -1,65 +0,0 @@
/*
* DynamORM - Dynamic Object-Relational Mapping library.
* Copyright (c) 2012-2015, Grzegorz Russek (grzegorz.russek@gmail.com)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*
* See: http://opensource.org/licenses/bsd-license.php
*/
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("DynamORM.Tests")]
[assembly: AssemblyDescription("Dynamic Object-Relational Mapping tests library.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("RUSSEK Software")]
[assembly: AssemblyProduct("DynamORM")]
[assembly: AssemblyCopyright("Copyright © RUSSEK Software 2012")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("1d8b751b-b3ec-481d-9f7f-14d6e6eb0fde")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0.1")]
[assembly: AssemblyFileVersion("1.1.0.1")]

View File

@@ -29,16 +29,16 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using DynamORM.Tests.Helpers; using DynamORM.Tests.Helpers;
using NUnit.Framework; using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace DynamORM.Tests.Select namespace DynamORM.Tests.Select
{ {
/// <summary>Test typed ORM.</summary> /// <summary>Test typed ORM.</summary>
[TestFixture] [TestClass]
public class RenamedTypedAccessTests : TypedAccessTests<Users> public class RenamedTypedAccessTests : TypedAccessTests<Users>
{ {
/// <summary>Test something fancy... like: <code>select "first", count("first") aggregatefield from "users" group by "first" order by 2 desc;</code>.</summary> /// <summary>Test something fancy... like: <code>select "first", count("first") aggregatefield from "users" group by "first" order by 2 desc;</code>.</summary>
[Test] [TestMethod]
public override void TestTypedFancyAggregateQuery() public override void TestTypedFancyAggregateQuery()
{ {
var v = (GetTestTable().Query(type: typeof(Users), columns: "first,first:AggregateField:count", group: "first", order: ":desc:2") as IEnumerable<dynamic>).ToList(); var v = (GetTestTable().Query(type: typeof(Users), columns: "first,first:AggregateField:count", group: "first", order: ":desc:2") as IEnumerable<dynamic>).ToList();
@@ -53,7 +53,7 @@ namespace DynamORM.Tests.Select
} }
/// <summary>Test something fancy... like: <code>select "first", count("first") aggregatefield from "users" group by "first" order by 2 desc;</code>.</summary> /// <summary>Test something fancy... like: <code>select "first", count("first") aggregatefield from "users" group by "first" order by 2 desc;</code>.</summary>
[Test] [TestMethod]
public override void TestGenericFancyAggregateQuery() public override void TestGenericFancyAggregateQuery()
{ {
var v = (GetTestTable().Query<Users>(columns: "first,first:AggregateField:count", group: "first", order: ":desc:2") as IEnumerable<dynamic>).ToList(); var v = (GetTestTable().Query<Users>(columns: "first,first:AggregateField:count", group: "first", order: ":desc:2") as IEnumerable<dynamic>).ToList();
@@ -68,21 +68,21 @@ namespace DynamORM.Tests.Select
} }
/// <summary>Test typed <c>First</c> method.</summary> /// <summary>Test typed <c>First</c> method.</summary>
[Test] [TestMethod]
public override void TestTypedFirst() public override void TestTypedFirst()
{ {
Assert.AreEqual(1, GetTestTable().First(type: typeof(Users), columns: "id").Id); Assert.AreEqual(1, GetTestTable().First(type: typeof(Users), columns: "id").Id);
} }
/// <summary>Test typed <c>Last</c> method.</summary> /// <summary>Test typed <c>Last</c> method.</summary>
[Test] [TestMethod]
public override void TestTypedLast() public override void TestTypedLast()
{ {
Assert.AreEqual(200, GetTestTable().Last(type: typeof(Users), columns: "id").Id); Assert.AreEqual(200, GetTestTable().Last(type: typeof(Users), columns: "id").Id);
} }
/// <summary>Test typed <c>Single</c> multi.</summary> /// <summary>Test typed <c>Single</c> multi.</summary>
[Test] [TestMethod]
public override void TestTypedSingleObject() public override void TestTypedSingleObject()
{ {
var exp = new { id = 19, first = "Ori", last = "Ellis" }; var exp = new { id = 19, first = "Ori", last = "Ellis" };
@@ -94,35 +94,35 @@ namespace DynamORM.Tests.Select
} }
/// <summary>Test typed where expression equal.</summary> /// <summary>Test typed where expression equal.</summary>
[Test] [TestMethod]
public override void TestTypedWhereEq() public override void TestTypedWhereEq()
{ {
Assert.AreEqual("hoyt.tran", GetTestTable().Single(type: typeof(Users), where: new DynamicColumn("id").Eq(100)).Login); Assert.AreEqual("hoyt.tran", GetTestTable().Single(type: typeof(Users), where: new DynamicColumn("id").Eq(100)).Login);
} }
/// <summary>Test typed where expression like.</summary> /// <summary>Test typed where expression like.</summary>
[Test] [TestMethod]
public override void TestTypedWhereLike() public override void TestTypedWhereLike()
{ {
Assert.AreEqual(100, GetTestTable().Single(type: typeof(Users), where: new DynamicColumn("login").Like("Hoyt.%")).Id); Assert.AreEqual(100, GetTestTable().Single(type: typeof(Users), where: new DynamicColumn("login").Like("Hoyt.%")).Id);
} }
/// <summary>Test generic <c>First</c> method.</summary> /// <summary>Test generic <c>First</c> method.</summary>
[Test] [TestMethod]
public override void TestGenericFirst() public override void TestGenericFirst()
{ {
Assert.AreEqual(1, GetTestTable().First<Users>(columns: "id").Id); Assert.AreEqual(1, GetTestTable().First<Users>(columns: "id").Id);
} }
/// <summary>Test generic <c>Last</c> method.</summary> /// <summary>Test generic <c>Last</c> method.</summary>
[Test] [TestMethod]
public override void TestGenericLast() public override void TestGenericLast()
{ {
Assert.AreEqual(200, GetTestTable().Last<Users>(columns: "id").Id); Assert.AreEqual(200, GetTestTable().Last<Users>(columns: "id").Id);
} }
/// <summary>Test generic <c>Single</c> multi.</summary> /// <summary>Test generic <c>Single</c> multi.</summary>
[Test] [TestMethod]
public override void TestGenericSingleObject() public override void TestGenericSingleObject()
{ {
var exp = new { id = 19, first = "Ori", last = "Ellis" }; var exp = new { id = 19, first = "Ori", last = "Ellis" };
@@ -134,14 +134,14 @@ namespace DynamORM.Tests.Select
} }
/// <summary>Test generic where expression equal.</summary> /// <summary>Test generic where expression equal.</summary>
[Test] [TestMethod]
public override void TestGenericWhereEq() public override void TestGenericWhereEq()
{ {
Assert.AreEqual("hoyt.tran", GetTestTable().Single<Users>(where: new DynamicColumn("id").Eq(100)).Login); Assert.AreEqual("hoyt.tran", GetTestTable().Single<Users>(where: new DynamicColumn("id").Eq(100)).Login);
} }
/// <summary>Test generic where expression like.</summary> /// <summary>Test generic where expression like.</summary>
[Test] [TestMethod]
public override void TestGenericWhereLike() public override void TestGenericWhereLike()
{ {
Assert.AreEqual(100, GetTestTable().Single<Users>(where: new DynamicColumn("login").Like("Hoyt.%")).Id); Assert.AreEqual(100, GetTestTable().Single<Users>(where: new DynamicColumn("login").Like("Hoyt.%")).Id);

View File

@@ -127,7 +127,7 @@ namespace DynamORM.Tests.Select
Assert.AreEqual(200, GetTestBuilder() Assert.AreEqual(200, GetTestBuilder()
.From(x => x(typeof(T)).As(x.t)) .From(x => x(typeof(T)).As(x.t))
.Select(x => x.Count(x.t.id)) .Select(x => x.Count(x.t.id))
.Scalar()); .ScalarAs<int>());
} }
/// <summary>Test count with in statement.</summary> /// <summary>Test count with in statement.</summary>
@@ -149,7 +149,7 @@ namespace DynamORM.Tests.Select
.From(x => x(typeof(T)).As(x.t)) .From(x => x(typeof(T)).As(x.t))
.Where(x => x.last.In(new object[] { "Hendricks", "Goodwin", "Freeman" }.Take(3))) .Where(x => x.last.In(new object[] { "Hendricks", "Goodwin", "Freeman" }.Take(3)))
.Select(x => x.Count()) .Select(x => x.Count())
.Scalar()); .ScalarAs<int>());
} }
/// <summary>Test count with in statement.</summary> /// <summary>Test count with in statement.</summary>
@@ -171,7 +171,7 @@ namespace DynamORM.Tests.Select
.From(x => x(typeof(T)).As(x.t)) .From(x => x(typeof(T)).As(x.t))
.Where(x => x.last.In(new object[] { "Hendricks", "Goodwin", "Freeman" })) .Where(x => x.last.In(new object[] { "Hendricks", "Goodwin", "Freeman" }))
.Select(x => x.Count()) .Select(x => x.Count())
.Scalar()); .ScalarAs<int>());
} }
/// <summary>Test typed <c>First</c> method.</summary> /// <summary>Test typed <c>First</c> method.</summary>
@@ -231,7 +231,7 @@ namespace DynamORM.Tests.Select
Assert.AreEqual(1, GetTestBuilder() Assert.AreEqual(1, GetTestBuilder()
.From(x => x(typeof(T)).As(x.t)) .From(x => x(typeof(T)).As(x.t))
.Select(x => x.Min(x.t.id)) .Select(x => x.Min(x.t.id))
.Scalar()); .ScalarAs<int>());
} }
/// <summary>Test typed <c>Min</c> method.</summary> /// <summary>Test typed <c>Min</c> method.</summary>
@@ -248,7 +248,7 @@ namespace DynamORM.Tests.Select
Assert.AreEqual(200, GetTestBuilder() Assert.AreEqual(200, GetTestBuilder()
.From(x => x(typeof(T)).As(x.t)) .From(x => x(typeof(T)).As(x.t))
.Select(x => x.Max(x.t.id)) .Select(x => x.Max(x.t.id))
.Scalar()); .ScalarAs<int>());
} }
/// <summary>Test typed <c>Min</c> method.</summary> /// <summary>Test typed <c>Min</c> method.</summary>
@@ -282,7 +282,7 @@ namespace DynamORM.Tests.Select
Assert.AreEqual(20100, GetTestBuilder() Assert.AreEqual(20100, GetTestBuilder()
.From(x => x(typeof(T)).As(x.t)) .From(x => x(typeof(T)).As(x.t))
.Select(x => x.Sum(x.t.id)) .Select(x => x.Sum(x.t.id))
.Scalar()); .ScalarAs<int>());
} }
/// <summary>Test typed <c>Scalar</c> method for invalid operation exception.</summary> /// <summary>Test typed <c>Scalar</c> method for invalid operation exception.</summary>
@@ -516,7 +516,7 @@ namespace DynamORM.Tests.Select
.From(x => x(typeof(T)).As(x.t)) .From(x => x(typeof(T)).As(x.t))
.Where(x => x.t.id != 100) .Where(x => x.t.id != 100)
.Select(x => x.Count()) .Select(x => x.Count())
.Scalar()); .ScalarAs<int>());
} }
/// <summary>Test typed where expression like.</summary> /// <summary>Test typed where expression like.</summary>
@@ -550,7 +550,7 @@ namespace DynamORM.Tests.Select
.From(x => x(typeof(T)).As(x.t)) .From(x => x(typeof(T)).As(x.t))
.Where(x => x.t.login.NotLike("Hoyt.%")) .Where(x => x.t.login.NotLike("Hoyt.%"))
.Select(x => x.Count()) .Select(x => x.Count())
.Scalar()); .ScalarAs<int>());
} }
/// <summary>Test typed where expression not like.</summary> /// <summary>Test typed where expression not like.</summary>
@@ -561,7 +561,7 @@ namespace DynamORM.Tests.Select
.From(x => x(typeof(T)).As(x.t)) .From(x => x(typeof(T)).As(x.t))
.Where(x => !x.t.login.Like("Hoyt.%")) .Where(x => !x.t.login.Like("Hoyt.%"))
.Select(x => x.Count()) .Select(x => x.Count())
.Scalar()); .ScalarAs<int>());
} }
/// <summary>Test typed where expression greater.</summary> /// <summary>Test typed where expression greater.</summary>
@@ -579,7 +579,7 @@ namespace DynamORM.Tests.Select
.From(x => x(typeof(T)).As(x.t)) .From(x => x(typeof(T)).As(x.t))
.Where(x => x.t.id > 100) .Where(x => x.t.id > 100)
.Select(x => x.Count()) .Select(x => x.Count())
.Scalar()); .ScalarAs<int>());
} }
/// <summary>Test typed where expression greater or equal.</summary> /// <summary>Test typed where expression greater or equal.</summary>
@@ -597,7 +597,7 @@ namespace DynamORM.Tests.Select
.From(x => x(typeof(T)).As(x.t)) .From(x => x(typeof(T)).As(x.t))
.Where(x => x.t.id >= 100) .Where(x => x.t.id >= 100)
.Select(x => x.Count()) .Select(x => x.Count())
.Scalar()); .ScalarAs<int>());
} }
/// <summary>Test typed where expression less.</summary> /// <summary>Test typed where expression less.</summary>
@@ -615,7 +615,7 @@ namespace DynamORM.Tests.Select
.From(x => x(typeof(T)).As(x.t)) .From(x => x(typeof(T)).As(x.t))
.Where(x => x.t.id < 100) .Where(x => x.t.id < 100)
.Select(x => x.Count()) .Select(x => x.Count())
.Scalar()); .ScalarAs<int>());
} }
/// <summary>Test typed where expression less or equal.</summary> /// <summary>Test typed where expression less or equal.</summary>
@@ -633,7 +633,7 @@ namespace DynamORM.Tests.Select
.From(x => x(typeof(T)).As(x.t)) .From(x => x(typeof(T)).As(x.t))
.Where(x => x.t.id <= 100) .Where(x => x.t.id <= 100)
.Select(x => x.Count()) .Select(x => x.Count())
.Scalar()); .ScalarAs<int>());
} }
/// <summary>Test typed where expression between.</summary> /// <summary>Test typed where expression between.</summary>
@@ -651,7 +651,7 @@ namespace DynamORM.Tests.Select
.From(x => x(typeof(T)).As(x.t)) .From(x => x(typeof(T)).As(x.t))
.Where(x => x.t.id.Between(75, 100)) .Where(x => x.t.id.Between(75, 100))
.Select(x => x.Count()) .Select(x => x.Count())
.Scalar()); .ScalarAs<int>());
} }
/// <summary>Test typed where expression in parameters.</summary> /// <summary>Test typed where expression in parameters.</summary>
@@ -676,7 +676,7 @@ namespace DynamORM.Tests.Select
.From(x => x(typeof(T)).As(x.t)) .From(x => x(typeof(T)).As(x.t))
.Where(x => x.t.id.In(75, 99, 100)) .Where(x => x.t.id.In(75, 99, 100))
.Select(x => x.Count()) .Select(x => x.Count())
.Scalar()); .ScalarAs<int>());
} }
/// <summary>Test typed where expression in array.</summary> /// <summary>Test typed where expression in array.</summary>
@@ -687,7 +687,7 @@ namespace DynamORM.Tests.Select
.From(x => x(typeof(T)).As(x.t)) .From(x => x(typeof(T)).As(x.t))
.Where(x => x.t.id.In(new[] { 75, 99, 100 })) .Where(x => x.t.id.In(new[] { 75, 99, 100 }))
.Select(x => x.Count()) .Select(x => x.Count())
.Scalar()); .ScalarAs<int>());
} }
#endregion Where typed #endregion Where typed

View File

@@ -71,32 +71,5 @@ namespace DynamORM
: base(string.Format("{0}{1}{2}", message, Environment.NewLine, command != null ? command.DumpToString() : string.Empty), innerException) : base(string.Format("{0}{1}{2}", message, Environment.NewLine, command != null ? command.DumpToString() : string.Empty), innerException)
{ {
} }
/// <summary>Initializes a new instance of the
/// <see cref="DynamicQueryException"/> class.</summary>
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo" />
/// that holds the serialized object data about the exception being thrown.</param>
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext" />
/// that contains contextual information about the source or destination.</param>
public DynamicQueryException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
/// <summary>When overridden in a derived class, sets the
/// <see cref="T:System.Runtime.Serialization.SerializationInfo" />
/// with information about the exception.</summary>
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo" />
/// that holds the serialized object data about the exception being thrown.</param>
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext" />
/// that contains contextual information about the source or destination.</param>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Read="*AllFiles*" PathDiscovery="*AllFiles*" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="SerializationFormatter" />
/// </PermissionSet>
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
base.GetObjectData(info, context);
}
} }
} }

View File

@@ -1395,7 +1395,7 @@ namespace DynamORM.Helpers.Dynamics
catch (TargetInvocationException e) catch (TargetInvocationException e)
{ {
if (e.InnerException != null) throw e.InnerException; if (e.InnerException != null) throw e.InnerException;
else throw e; throw;
} }
} }

View File

@@ -24,12 +24,5 @@ namespace DynamORM.Mapper
public DynamicMapperException(string message, Exception innerException) : base(message, innerException) public DynamicMapperException(string message, Exception innerException) : base(message, innerException)
{ {
} }
/// <summary>Initializes a new instance of the <see cref="DynamicMapperException"/> class.</summary>
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the exception being thrown.</param>
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the source or destination.</param>
protected DynamicMapperException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
} }
} }