-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
pospisilb
committed
Oct 3, 2017
1 parent
1892f4a
commit 2a2b11b
Showing
25 changed files
with
1,051 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<configuration> | ||
<configSections> | ||
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> | ||
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> | ||
</configSections> | ||
<entityFramework> | ||
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" /> | ||
<providers> | ||
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /> | ||
</providers> | ||
</entityFramework> | ||
<runtime> | ||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> | ||
<dependentAssembly> | ||
<assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" culture="neutral" /> | ||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" /> | ||
</dependentAssembly> | ||
</assemblyBinding> | ||
</runtime> | ||
</configuration> |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using Altairis.Samples.Data.Northwind.CodeFirst; | ||
using EntityFramework.Metadata.Extensions; | ||
using Xunit; | ||
|
||
namespace EF.BulkInsert.Cascade.Tests | ||
{ | ||
public class BulkInsertTest | ||
{ | ||
public BulkInsertTest() | ||
{ | ||
} | ||
|
||
[Fact] | ||
public void StuctualTest() | ||
{ | ||
using (var context = new NorthwindDbContext()) | ||
{ | ||
var propertyMaps = context.Db<Supplier>().Properties; | ||
// var columns = propertyMaps.Select(o => new | ||
// { | ||
// o.ColumnName, | ||
// GetValue = o.IsDiscriminator | ||
// ? x => typeof(T).Name | ||
// : ExpressHelper.GetPropGetter<T>(o.PropertyName).Compile() | ||
// }).ToArray(); | ||
} | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using System.Data; | ||
using FluentAssertions.Execution; | ||
using KellermanSoftware.CompareNetObjects; | ||
|
||
namespace EF.BulkInsert.Cascade.Tests | ||
{ | ||
public static class DataTableExtension | ||
{ | ||
public static void ShouldBeSame(this DataTable t1, DataTable t2) | ||
{ | ||
var comparisonResult = new CompareLogic().Compare(t1, t2); | ||
if (!comparisonResult.AreEqual) | ||
{ | ||
throw new AssertionFailedException(comparisonResult.DifferencesString); | ||
} | ||
} | ||
} | ||
} |
132 changes: 132 additions & 0 deletions
132
CascadeBulkInsert.Tests/EF.BulkInsert.CascadeTests.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{AD8F025C-8968-4B1A-97AD-29950905A3A2}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>EF.BulkInsert.Cascade.Tests</RootNamespace> | ||
<AssemblyName>EF.BulkInsert.Cascade.Tests</AssemblyName> | ||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> | ||
<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</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</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="Altairis.Samples.Data.Northwind.CodeFirst, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\Altairis.Samples.Data.Northwind.CodeFirst.1.0.0\lib\net45\Altairis.Samples.Data.Northwind.CodeFirst.dll</HintPath> | ||
</Reference> | ||
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll</HintPath> | ||
<Private>True</Private> | ||
</Reference> | ||
<Reference Include="EntityFramework.Metadata, Version=1.0.2.0, Culture=neutral, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\EntityFramework.Metadata.1.0.2.0\lib\net45\EntityFramework.Metadata.dll</HintPath> | ||
</Reference> | ||
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll</HintPath> | ||
<Private>True</Private> | ||
</Reference> | ||
<Reference Include="FluentAssertions, Version=4.18.0.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\FluentAssertions.4.18.0\lib\net45\FluentAssertions.dll</HintPath> | ||
<Private>True</Private> | ||
</Reference> | ||
<Reference Include="FluentAssertions.Core, Version=4.18.0.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\FluentAssertions.4.18.0\lib\net45\FluentAssertions.Core.dll</HintPath> | ||
<Private>True</Private> | ||
</Reference> | ||
<Reference Include="KellermanSoftware.Compare-NET-Objects, Version=3.6.0.0, Culture=neutral, PublicKeyToken=d970ace04cc85217, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\CompareNETObjects.3.06.0.0\lib\net452\KellermanSoftware.Compare-NET-Objects.dll</HintPath> | ||
<Private>True</Private> | ||
</Reference> | ||
<Reference Include="System" /> | ||
<Reference Include="System.ComponentModel.DataAnnotations" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\Microsoft.SqlServer.Compact.4.0.8854.1\lib\net40\System.Data.SqlServerCe.dll</HintPath> | ||
<Private>True</Private> | ||
</Reference> | ||
<Reference Include="System.Data.SqlServerCe.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\Microsoft.SqlServer.Compact.4.0.8854.1\lib\net40\System.Data.SqlServerCe.Entity.dll</HintPath> | ||
<Private>True</Private> | ||
</Reference> | ||
<Reference Include="System.Xml" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="xunit.abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll</HintPath> | ||
<Private>True</Private> | ||
</Reference> | ||
<Reference Include="xunit.assert, Version=2.1.0.3179, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\xunit.assert.2.1.0\lib\dotnet\xunit.assert.dll</HintPath> | ||
<Private>True</Private> | ||
</Reference> | ||
<Reference Include="xunit.core, Version=2.1.0.3179, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\xunit.extensibility.core.2.1.0\lib\dotnet\xunit.core.dll</HintPath> | ||
<Private>True</Private> | ||
</Reference> | ||
<Reference Include="xunit.execution.desktop, Version=2.1.0.3179, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\xunit.extensibility.execution.2.1.0\lib\net45\xunit.execution.desktop.dll</HintPath> | ||
<Private>True</Private> | ||
</Reference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="DataTableExtension.cs" /> | ||
<Compile Include="BulkInsertTest.cs" /> | ||
<Compile Include="MetaDataTests\DataTableTests.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
<Compile Include="TestContext\BasicEntity.cs" /> | ||
<Compile Include="MetaDataTests\DbContextCollection.cs" /> | ||
<Compile Include="TestContext\InheritanceBase.cs" /> | ||
<Compile Include="TestContext\TableNameSpecifiedEntity.cs" /> | ||
<Compile Include="TestContext\TestContext.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="App.config" /> | ||
<None Include="AppReadme\Compare-NET-Objects-Help.chm" /> | ||
<None Include="packages.config" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\CascadeBulkInsert\EF.BulkInsert.Cascade.csproj"> | ||
<Project>{555355a8-8ad2-4b0b-9f31-6966e0e79037}</Project> | ||
<Name>EF.BulkInsert.Cascade</Name> | ||
</ProjectReference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Content Include="App_Data\Northwind.sdf"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</Content> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
<PropertyGroup> | ||
<PostBuildEvent> | ||
if not exist "$(TargetDir)x86" md "$(TargetDir)x86" | ||
xcopy /s /y "$(SolutionDir)packages\Microsoft.SqlServer.Compact.4.0.8854.1\NativeBinaries\x86\*.*" "$(TargetDir)x86" | ||
if not exist "$(TargetDir)amd64" md "$(TargetDir)amd64" | ||
xcopy /s /y "$(SolutionDir)packages\Microsoft.SqlServer.Compact.4.0.8854.1\NativeBinaries\amd64\*.*" "$(TargetDir)amd64"</PostBuildEvent> | ||
</PropertyGroup> | ||
<!-- 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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
using System.Data; | ||
using EF.BulkInsert.Cascade.Tests.TestContext; | ||
using Xunit; | ||
|
||
namespace EF.BulkInsert.Cascade.Tests.MetaDataTests | ||
{ | ||
[Collection(nameof(DbContextCollection))] | ||
public class DataTableTests | ||
{ | ||
private readonly TableNameTestContext _context; | ||
|
||
public DataTableTests(TableNameTestContext context) | ||
{ | ||
_context = context; | ||
} | ||
|
||
|
||
|
||
[Fact] | ||
public void StuctualTest() | ||
{ | ||
var dataTable = new DataTable(); | ||
dataTable.Columns.AddRange(new[] | ||
{ | ||
new DataColumn(nameof(BasicEntity.Id),typeof(long)), | ||
new DataColumn(nameof(BasicEntity.Name),typeof(string)), | ||
}); | ||
var dataRow = dataTable.Rows.Add(); | ||
dataRow[nameof(BasicEntity.Id)] = 1; | ||
dataRow[nameof(BasicEntity.Name)] = "Test"; | ||
_context.GetDataReader(new[]{new BasicEntity {Id = 1,Name = "Test"}, }).ShouldBeSame(dataTable); | ||
} | ||
/* | ||
[Fact] | ||
public void BasicInheritanceTest() | ||
{ | ||
var columnInfos = _context.GetColumns<InheritanceA>().ToArray(); | ||
columnInfos.ShouldAllBeEquivalentTo( | ||
new IColumnInfo<InheritanceA>[] | ||
{ | ||
new ColumnInfo<InheritanceA>(nameof(InheritanceA.Id)), | ||
new ColumnInfo<InheritanceA>(nameof(InheritanceA.Name)), | ||
new ColumnInfo<InheritanceA>(nameof(InheritanceA.ColumnA)), | ||
new ColumnInfoDescriptor<InheritanceA>(), | ||
}); | ||
} | ||
[Fact] | ||
public void InheritanceTest() | ||
{ | ||
_context.GetColumns<InheritanceB>().ShouldAllBeEquivalentTo( | ||
new IColumnInfo<InheritanceB>[] | ||
{ | ||
new ColumnInfo<InheritanceB>(nameof(InheritanceB.Id)), | ||
new ColumnInfo<InheritanceB>(nameof(InheritanceB.Name)), | ||
}); | ||
} | ||
[Fact] | ||
public void Inheritance2Test() | ||
{ | ||
var columnInfos = _context.GetColumns<InheritanceAa>().ToArray(); | ||
columnInfos.ShouldAllBeEquivalentTo( | ||
new IColumnInfo<InheritanceAa>[] | ||
{ | ||
new ColumnInfo<InheritanceAa>(nameof(InheritanceAa.Id)), | ||
new ColumnInfo<InheritanceAa>(nameof(InheritanceAa.Name)), | ||
new ColumnInfo<InheritanceAa>(nameof(InheritanceAa.ColumnA)), | ||
new ColumnInfo<InheritanceAa>(nameof(InheritanceAa.ColumnAa)), | ||
new ColumnInfoDescriptor<InheritanceA>(), | ||
}); | ||
} | ||
*/ | ||
|
||
} | ||
|
||
} |
10 changes: 10 additions & 0 deletions
10
CascadeBulkInsert.Tests/MetaDataTests/DbContextCollection.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using EF.BulkInsert.Cascade.Tests.TestContext; | ||
using Xunit; | ||
|
||
namespace EF.BulkInsert.Cascade.Tests.MetaDataTests | ||
{ | ||
[CollectionDefinition(nameof(DbContextCollection))] | ||
public class DbContextCollection : ICollectionFixture<TableNameTestContext> | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
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("CascadeBulkInsert.Tests")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("CascadeBulkInsert.Tests")] | ||
[assembly: AssemblyCopyright("Copyright © 2016")] | ||
[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("ad8f025c-8968-4b1a-97ad-29950905a3a2")] | ||
|
||
// 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.0.0.0")] | ||
[assembly: AssemblyFileVersion("1.0.0.0")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace EF.BulkInsert.Cascade.Tests.TestContext | ||
{ | ||
public class BasicEntity | ||
{ | ||
public long Id { get; set; } | ||
public string Name { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
namespace EF.BulkInsert.Cascade.Tests.TestContext | ||
{ | ||
public abstract class InheritanceBase | ||
{ | ||
public long Id { get; set; } | ||
public string Name { get; set; } | ||
} | ||
|
||
public class InheritanceA : InheritanceBase | ||
{ | ||
public string ColumnA { get; set; } | ||
} | ||
|
||
public class InheritanceAa : InheritanceA | ||
{ | ||
public string ColumnAa { get; set; } | ||
} | ||
|
||
|
||
public class InheritanceB : InheritanceBase | ||
{ | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
CascadeBulkInsert.Tests/TestContext/TableNameSpecifiedEntity.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using System.ComponentModel.DataAnnotations.Schema; | ||
|
||
namespace EF.BulkInsert.Cascade.Tests.TestContext | ||
{ | ||
[Table("TestTableName")] | ||
public class TableNameSpecifiedEntity | ||
{ | ||
public long Id { get; set; } | ||
public string Name { get; set; } | ||
|
||
public ComplexType ComplexType { get; set; } | ||
} | ||
|
||
[ComplexType] | ||
public class ComplexType | ||
{ | ||
public string ComplexColumn { get; set; } | ||
} | ||
} |
Oops, something went wrong.