Added Design tests

2.2-servicing
bubibubi 8 years ago
parent 731949ac74
commit 892823e4f6

@ -35,6 +35,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{B7FF1850-2
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EFCore.Jet.Tests", "test\EFCore.Jet.Tests\EFCore.Jet.Tests.csproj", "{C38B58D7-F346-40A2-9849-D12CB9EC5C69}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EFCore.Jet.Design.FunctionalTests", "test\EFCore.Jet.Design.FunctionalTest\EFCore.Jet.Design.FunctionalTests.csproj", "{543477FB-CF81-446D-AB02-1E41382DED5B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -91,6 +93,14 @@ Global
{C38B58D7-F346-40A2-9849-D12CB9EC5C69}.Release|Any CPU.Build.0 = Release|Any CPU
{C38B58D7-F346-40A2-9849-D12CB9EC5C69}.Release|x86.ActiveCfg = Release|Any CPU
{C38B58D7-F346-40A2-9849-D12CB9EC5C69}.Release|x86.Build.0 = Release|Any CPU
{543477FB-CF81-446D-AB02-1E41382DED5B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{543477FB-CF81-446D-AB02-1E41382DED5B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{543477FB-CF81-446D-AB02-1E41382DED5B}.Debug|x86.ActiveCfg = Debug|Any CPU
{543477FB-CF81-446D-AB02-1E41382DED5B}.Debug|x86.Build.0 = Debug|Any CPU
{543477FB-CF81-446D-AB02-1E41382DED5B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{543477FB-CF81-446D-AB02-1E41382DED5B}.Release|Any CPU.Build.0 = Release|Any CPU
{543477FB-CF81-446D-AB02-1E41382DED5B}.Release|x86.ActiveCfg = Release|Any CPU
{543477FB-CF81-446D-AB02-1E41382DED5B}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -102,6 +112,7 @@ Global
{50CA2970-B995-4D28-9F6C-F7CA4940F23A} = {6A8DE399-1804-4113-A408-F23B7F5C9CAC}
{3C88D49A-7EF2-42BA-A8D7-9DF7D358FD24} = {6A8DE399-1804-4113-A408-F23B7F5C9CAC}
{C38B58D7-F346-40A2-9849-D12CB9EC5C69} = {6A8DE399-1804-4113-A408-F23B7F5C9CAC}
{543477FB-CF81-446D-AB02-1E41382DED5B} = {6A8DE399-1804-4113-A408-F23B7F5C9CAC}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {9359773D-6399-447E-9814-6CB41C2FB664}

@ -7,8 +7,8 @@
<ProjectGuid>{543477FB-CF81-446D-AB02-1E41382DED5B}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>EntityFramework.SqlServerCompact40.Design.FunctionalTest</RootNamespace>
<AssemblyName>EntityFramework.SqlServerCompact40.Design.FunctionalTest</AssemblyName>
<RootNamespace>EntityFrameworkCore.Jet.Design.FunctionalTests</RootNamespace>
<AssemblyName>EntityFrameworkCore.Jet.Design.FunctionalTests</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
@ -33,8 +33,8 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\EntityFramework.SqlServerCompact.FunctionalTests\SqlCeTestStore.cs">
<Link>ReverseEngineering\SqlCeTestStore.cs</Link>
<Compile Include="..\EFCore.Jet.FunctionalTests\TestUtilities\JetTestStore.cs">
<Link>JetTestStore.cs</Link>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Content Include="ReverseEngineering\ExpectedResults\NonNullBoolWithDefault.cs">
@ -52,11 +52,11 @@
<Content Include="ReverseEngineering\ExpectedResults\StringKeysPosts.cs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Compile Include="ReverseEngineering\SqlCeE2EFixture.cs" />
<Compile Include="ReverseEngineering\SqlCeE2ETests.cs" />
<Compile Include="ScaffoldingTypeMapperSqlCeTest.cs" />
<Compile Include="SqlCeDatabaseModelFactoryTest.cs" />
<Compile Include="SqlCeDatabaseModelFixture.cs" />
<Compile Include="ReverseEngineering\JetE2EFixture.cs" />
<Compile Include="ReverseEngineering\JetE2ETests.cs" />
<Compile Include="ScaffoldingTypeMapperJetTest.cs" />
<Compile Include="JetDatabaseModelFactoryTest.cs" />
<Compile Include="JetDatabaseModelFixture.cs" />
</ItemGroup>
<ItemGroup>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
@ -245,10 +245,6 @@
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Data" />
<Reference Include="System.Data.SqlServerCe, Version=3.5.1.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\Program Files (x86)\Microsoft SQL Server Compact Edition\v4.0\Desktop\System.Data.SqlServerCe.dll</HintPath>
</Reference>
<Reference Include="System.Diagnostics.DiagnosticSource, Version=4.0.2.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Diagnostics.DiagnosticSource.4.4.1\lib\net46\System.Diagnostics.DiagnosticSource.dll</HintPath>
</Reference>
@ -282,16 +278,20 @@
<HintPath>..\..\packages\xunit.extensibility.execution.2.2.0\lib\net452\xunit.execution.desktop.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Provider40\EntityFramework.SqlServerCompact40.csproj">
<Project>{0bdb0cbb-c42a-45e5-8518-14e0c31119ad}</Project>
<Name>EntityFramework.SqlServerCompact40</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Analyzer Include="..\..\packages\Microsoft.CodeAnalysis.Analyzers.1.1.0\analyzers\dotnet\cs\Microsoft.CodeAnalysis.Analyzers.dll" />
<Analyzer Include="..\..\packages\Microsoft.CodeAnalysis.Analyzers.1.1.0\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.Analyzers.dll" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\EFCore.Jet\EFCore.Jet.csproj">
<Project>{d6966b04-4c38-4925-bcde-f8655f38d04c}</Project>
<Name>EFCore.Jet</Name>
</ProjectReference>
<ProjectReference Include="..\..\src\System.Data.Jet\System.Data.Jet.csproj">
<Project>{88be8b4f-8da9-42b9-9a1f-839451ba5f8c}</Project>
<Name>System.Data.Jet</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>

@ -3,17 +3,12 @@ using System.Collections.Generic;
using System.Linq;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Scaffolding;
using Microsoft.EntityFrameworkCore.Scaffolding.Internal;
using Microsoft.EntityFrameworkCore.Scaffolding.Metadata;
using Microsoft.EntityFrameworkCore.Scaffolding.Metadata.Internal;
using Microsoft.EntityFrameworkCore.Specification.Tests;
using Microsoft.Extensions.Logging;
using Xunit;
namespace Microsoft.EntityFrameworkCore
namespace EntityFrameworkCore.Jet.Design.FunctionalTests
{
public class SqlCeDatabaseModelFactoryTest : IClassFixture<SqlCeDatabaseModelFixture>
public class JetDatabaseModelFactoryTest : IClassFixture<JetDatabaseModelFixture>
{
[Fact]
public void It_reads_tables()
@ -284,12 +279,12 @@ CREATE TABLE [MountainsColumns] (
Assert.Empty(table.ForeignKeys);
}
private readonly SqlCeDatabaseModelFixture _fixture;
private readonly JetDatabaseModelFixture _fixture;
public DatabaseModel CreateModel(List<string> createSql, IEnumerable<string> tables = null)
=> _fixture.CreateModel(createSql, tables);
public SqlCeDatabaseModelFactoryTest(SqlCeDatabaseModelFixture fixture)
public JetDatabaseModelFactoryTest(JetDatabaseModelFixture fixture)
{
_fixture = fixture;
}

@ -2,21 +2,21 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using EntityFramework.Jet.FunctionalTests;
using EntityFrameworkCore.Jet.Scaffolding.Internal;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Internal;
using Microsoft.EntityFrameworkCore.Scaffolding.Internal;
using Microsoft.EntityFrameworkCore.Scaffolding.Metadata;
using Microsoft.EntityFrameworkCore.TestUtilities;
using Microsoft.EntityFrameworkCore.Utilities;
using Microsoft.Extensions.Logging;
using Microsoft.EntityFrameworkCore.Specification.Tests;
namespace Microsoft.EntityFrameworkCore
namespace EntityFrameworkCore.Jet.Design.FunctionalTests
{
public class SqlCeDatabaseModelFixture : IDisposable
public class JetDatabaseModelFixture : IDisposable
{
public SqlCeDatabaseModelFixture()
public JetDatabaseModelFixture()
{
TestStore = SqlCeTestStore.CreateScratch(true);
TestStore = JetTestStore.CreateScratch(true);
}
public TestDesignLoggerFactory TestDesignLoggerFactory { get; } = new TestDesignLoggerFactory();
@ -28,7 +28,7 @@ namespace Microsoft.EntityFrameworkCore
TestStore.ExecuteNonQuery(sql);
}
return new SqlCeDatabaseModelFactory(
return new JetDatabaseModelFactory(
new DiagnosticsLogger<DbLoggerCategory.Scaffolding>(
TestDesignLoggerFactory,
new LoggingOptions(),
@ -38,7 +38,7 @@ namespace Microsoft.EntityFrameworkCore
public IEnumerable<T> Query<T>(string sql, params object[] parameters) => TestStore.Query<T>(sql, parameters);
public SqlCeTestStore TestStore { get; }
public JetTestStore TestStore { get; }
public void ExecuteNonQuery(string sql) => TestStore.ExecuteNonQuery(sql);

@ -1,35 +1,4 @@
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("EntityFramework.SqlServerCompact40.Design.FunctionalTest")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EntityFramework.SqlServerCompact40.Design.FunctionalTest")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[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("543477fb-cf81-446d-ab02-1e41382ded5b")]
// 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")]
[assembly: AssemblyTitle("EntityFrameworkCore.Jet.Design.FunctionalTests")]
[assembly: AssemblyDescription("Design functional (integration) tests for Jet Entity framework core provider. These tests are original EF Core provider tests")]

@ -27,7 +27,7 @@ namespace E2ETest.Namespace
if (!optionsBuilder.IsConfigured)
{
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. See http://go.microsoft.com/fwlink/?LinkId=723263 for guidance on storing connection strings.
optionsBuilder.UseSqlCe(@"Data Source=E2E.sdf");
optionsBuilder.UseJet(@"Data Source=E2E.sdf");
}
}

@ -27,7 +27,7 @@ namespace E2ETest.Namespace
if (!optionsBuilder.IsConfigured)
{
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. See http://go.microsoft.com/fwlink/?LinkId=723263 for guidance on storing connection strings.
optionsBuilder.UseSqlCe(@"{{connectionString}}");
optionsBuilder.UseJet(@"{{connectionString}}");
}
}

@ -13,7 +13,7 @@ namespace E2ETest.Namespace
if (!optionsBuilder.IsConfigured)
{
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. See http://go.microsoft.com/fwlink/?LinkId=723263 for guidance on storing connection strings.
optionsBuilder.UseSqlCe(@"{{connectionString}}");
optionsBuilder.UseJet(@"{{connectionString}}");
}
}

@ -14,7 +14,7 @@ namespace E2ETest.Namespace
if (!optionsBuilder.IsConfigured)
{
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. See http://go.microsoft.com/fwlink/?LinkId=723263 for guidance on storing connection strings.
optionsBuilder.UseSqlCe(@"{{connectionString}}");
optionsBuilder.UseJet(@"{{connectionString}}");
}
}

@ -0,0 +1,12 @@
using EntityFramework.Jet.FunctionalTests;
namespace EntityFrameworkCore.Jet.Design.FunctionalTests.ReverseEngineering
{
public class JetE2EFixture
{
public JetE2EFixture()
{
JetTestStore.GetOrCreateShared("E2E", () => { });
}
}
}

@ -1,24 +1,25 @@
using System.Collections.Generic;
using System.Data.Jet;
using System.IO;
using System.Linq;
using Microsoft.EntityFrameworkCore.Scaffolding;
using EntityFramework.Jet.FunctionalTests;
using EntityFrameworkCore.Jet.Design.Internal;
using Microsoft.EntityFrameworkCore.ReverseEngineering;
using Microsoft.EntityFrameworkCore.Scaffolding.Internal;
using Microsoft.EntityFrameworkCore.TestUtilities;
using Microsoft.EntityFrameworkCore.TestUtilities.Xunit;
using Microsoft.Extensions.DependencyInjection;
using Xunit;
using Xunit.Abstractions;
using Microsoft.EntityFrameworkCore.ReverseEngineering;
using Microsoft.EntityFrameworkCore.TestUtilities.Xunit;
using Microsoft.EntityFrameworkCore.TestUtilities;
using Microsoft.EntityFrameworkCore.Specification.Tests;
namespace EntityFramework.SqlServerCompact40.Design.FunctionalTest.ReverseEngineering
namespace EntityFrameworkCore.Jet.Design.FunctionalTests.ReverseEngineering
{
public class SqlCeE2ETests : E2ETestBase, IClassFixture<SqlCeE2EFixture>
public class JetE2ETests : E2ETestBase, IClassFixture<JetE2EFixture>
{
protected override string ProviderName => "EntityFrameworkCore.SqlServerCompact40.Design";
protected override void ConfigureDesignTimeServices(IServiceCollection services)
=> new SqlCeDesignTimeServices().ConfigureDesignTimeServices(services);
=> new JetDesignTimeServices().ConfigureDesignTimeServices(services);
public virtual string TestNamespace => "E2ETest.Namespace";
public virtual string TestProjectDir => Path.Combine("E2ETest", "Output");
@ -67,12 +68,12 @@ namespace EntityFramework.SqlServerCompact40.Design.FunctionalTest.ReverseEngine
};
// ReSharper disable once UnusedParameter.Local
public SqlCeE2ETests(SqlCeE2EFixture fixture, ITestOutputHelper output)
public JetE2ETests(JetE2EFixture fixture, ITestOutputHelper output)
: base(output)
{
}
private string _connectionString = @"Data Source=E2E.sdf";
private string _connectionString = JetConnection.GetConnectionString(@"E2E.accdb");
private static readonly List<string> _expectedEntityTypeFiles = new List<string>
{
@ -165,7 +166,7 @@ namespace EntityFramework.SqlServerCompact40.Design.FunctionalTest.ReverseEngine
[Fact]
public void Non_null_boolean_columns_with_default_constraint_become_nullable_properties()
{
using (var scratch = SqlCeTestStore.Create("NonNullBooleanWithDefaultConstraint"))
using (var scratch = JetTestStore.Create("NonNullBooleanWithDefaultConstraint"))
{
scratch.ExecuteNonQuery(@"
CREATE TABLE NonNullBoolWithDefault
@ -212,7 +213,7 @@ CREATE TABLE NonNullBoolWithDefault
[ConditionalFact]
public void Correct_arguments_to_scaffolding_typemapper()
{
using (var scratch = SqlCeTestStore.Create("StringKeys"))
using (var scratch = JetTestStore.Create("StringKeys"))
{
scratch.ExecuteNonQuery(@"
CREATE TABLE [StringKeysBlogs] (

@ -1,12 +0,0 @@
using Microsoft.EntityFrameworkCore.Specification.Tests;
namespace EntityFramework.SqlServerCompact40.Design.FunctionalTest.ReverseEngineering
{
public class SqlCeE2EFixture
{
public SqlCeE2EFixture()
{
SqlCeTestStore.GetOrCreateShared("E2E", () => { });
}
}
}

@ -1,12 +1,12 @@
using System;
using EntityFrameworkCore.Jet.Storage.Internal;
using Microsoft.EntityFrameworkCore.Scaffolding.Internal;
using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.EntityFrameworkCore.Storage.Internal;
using Xunit;
namespace Microsoft.EntityFrameworkCore
namespace EntityFrameworkCore.Jet.Design.FunctionalTests
{
public class ScaffoldingTypeMapperSqlCeTest
public class ScaffoldingTypeMapperJetTest
{
[Theory]
[InlineData(false)]
@ -186,6 +186,6 @@ namespace Microsoft.EntityFrameworkCore
private static ScaffoldingTypeMapper CreateMapper()
=> new ScaffoldingTypeMapper(
new SqlCeTypeMapper(new RelationalTypeMapperDependencies()));
new JetTypeMapper(new RelationalTypeMapperDependencies()));
}
}

@ -1,4 +1,4 @@
using System.Reflection;
[assembly: AssemblyTitle("EntityFrameworkCore.Jet.FunctionalTest")]
[assembly: AssemblyDescription("Functional (integration) tests for Jet Entity framework core provider. These tests are origina EF Core provider tests")]
[assembly: AssemblyTitle("EntityFrameworkCore.Jet.FunctionalTests")]
[assembly: AssemblyDescription("Functional (integration) tests for Jet Entity framework core provider. These tests are original EF Core provider tests")]
Loading…
Cancel
Save