Remove obsolete design tests.

pull/41/head
Lau 6 years ago
parent afd9d852cb
commit 2eef0b952f

@ -31,8 +31,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{B7FF1850-2
docs\README.md = docs\README.md
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EFCore.Jet.Design.FunctionalTests", "test\EFCore.Jet.Design.FunctionalTest\EFCore.Jet.Design.FunctionalTests.csproj", "{543477FB-CF81-446D-AB02-1E41382DED5B}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build help", "build help", "{20B764C9-8664-4609-A743-8CF32BA6CA69}"
ProjectSection(SolutionItems) = preProject
NuGet.Config = NuGet.Config
@ -119,18 +117,6 @@ Global
{3C88D49A-7EF2-42BA-A8D7-9DF7D358FD24}.Release|x64.Build.0 = Release|x64
{3C88D49A-7EF2-42BA-A8D7-9DF7D358FD24}.Release|x86.ActiveCfg = Release|Any CPU
{3C88D49A-7EF2-42BA-A8D7-9DF7D358FD24}.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|x64.ActiveCfg = Debug|x64
{543477FB-CF81-446D-AB02-1E41382DED5B}.Debug|x64.Build.0 = Debug|x64
{543477FB-CF81-446D-AB02-1E41382DED5B}.Debug|x86.ActiveCfg = Debug|x86
{543477FB-CF81-446D-AB02-1E41382DED5B}.Debug|x86.Build.0 = Debug|x86
{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|x64.ActiveCfg = Release|x64
{543477FB-CF81-446D-AB02-1E41382DED5B}.Release|x64.Build.0 = Release|x64
{543477FB-CF81-446D-AB02-1E41382DED5B}.Release|x86.ActiveCfg = Release|Any CPU
{543477FB-CF81-446D-AB02-1E41382DED5B}.Release|x86.Build.0 = Release|Any CPU
{770A076B-A448-499C-BB86-A37994C04523}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{770A076B-A448-499C-BB86-A37994C04523}.Debug|Any CPU.Build.0 = Debug|Any CPU
{770A076B-A448-499C-BB86-A37994C04523}.Debug|x64.ActiveCfg = Debug|Any CPU
@ -153,7 +139,6 @@ Global
{D6966B04-4C38-4925-BCDE-F8655F38D04C} = {F68095EE-6CD1-43A2-B498-6CA72CE2A0CB}
{50CA2970-B995-4D28-9F6C-F7CA4940F23A} = {6A8DE399-1804-4113-A408-F23B7F5C9CAC}
{3C88D49A-7EF2-42BA-A8D7-9DF7D358FD24} = {6A8DE399-1804-4113-A408-F23B7F5C9CAC}
{543477FB-CF81-446D-AB02-1E41382DED5B} = {6A8DE399-1804-4113-A408-F23B7F5C9CAC}
{770A076B-A448-499C-BB86-A37994C04523} = {6A8DE399-1804-4113-A408-F23B7F5C9CAC}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution

@ -1,42 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net461;netcoreapp3.1</TargetFrameworks>
<IsPackable>false</IsPackable>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<Platforms>AnyCPU;x86;x64</Platforms>
</PropertyGroup>
<ItemGroup>
<None Include="E2E.accdb">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Issue_4.mdb">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational.Specification.Tests" Version="2.2.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational.Design.Specification.Tests" Version="2.0.3" />
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="4.7.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="1.2.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\EFCore.Jet.FunctionalTests\EFCore.Jet.FunctionalTests.csproj" />
</ItemGroup>
</Project>

@ -1,81 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.EntityFrameworkCore.Scaffolding.Metadata;
using Xunit;
namespace EntityFrameworkCore.Jet.Design.FunctionalTests
{
public class Issue4Test : IClassFixture<JetDatabaseModelIssue4Fixture>
{
[Fact]
public void It_reads_tables()
{
var model = ReadModel();
Assert.Collection(model.Tables.OrderBy(t => t.Name),
d =>
{
Assert.Equal("Jet", d.Schema);
Assert.Equal("tAnsprechpartnertypen", d.Name);
},
e =>
{
Assert.Equal("Jet", e.Schema);
Assert.Equal("tBerichte", e.Name);
});
}
[Fact]
public void It_reads_columns()
{
var model = ReadModel();
var columns = model.Tables.Single(_ => _.Name == "tAnsprechpartnertypen").Columns;
Assert.All(
columns, c =>
{
Assert.Equal("Jet", c.Table.Schema);
Assert.Equal("tAnsprechpartnertypen", c.Table.Name);
});
Assert.Collection(
columns,
c1 =>
{
Assert.Equal("Bezeichnung", c1.Name);
Assert.Equal("varchar(255)", c1.StoreType);
Assert.True(c1.IsNullable);
Assert.Null(c1.DefaultValueSql);
},
c2 =>
{
Assert.Equal("Code", c2.Name);
Assert.Equal("byte", c2.StoreType);
Assert.True(c2.IsNullable);
Assert.Equal("0", c2.DefaultValueSql);
});
}
private readonly JetDatabaseModelFixture _fixture;
public DatabaseModel ReadModel(IEnumerable<string> tables = null)
=> _fixture.ReadModel(tables);
public Issue4Test(JetDatabaseModelIssue4Fixture fixture)
{
_fixture = fixture;
}
}
}

@ -1,296 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Scaffolding.Metadata;
using Xunit;
namespace EntityFrameworkCore.Jet.Design.FunctionalTests
{
public class JetDatabaseModelFactoryTest : IClassFixture<JetDatabaseModelFixture>
{
[Fact]
public void It_reads_tables()
{
var sql = new List<string>
{
"CREATE TABLE [Everest] ( id int );",
"CREATE TABLE [Denali] ( id int );"
};
var dbInfo = CreateModel(sql, new List<string> { "Everest", "Denali" });
Assert.Collection(dbInfo.Tables.OrderBy(t => t.Name),
d =>
{
Assert.Equal("Jet", d.Schema);
Assert.Equal("Denali", d.Name);
},
e =>
{
Assert.Equal("Jet", e.Schema);
Assert.Equal("Everest", e.Name);
});
}
[Fact]
public void It_reads_foreign_keys()
{
var sql = new List<string> {
"CREATE TABLE Ranges ( Id INT IDENTITY (1,1) PRIMARY KEY);",
"CREATE TABLE Mountains ( RangeId INT NOT NULL, FOREIGN KEY (RangeId) REFERENCES Ranges(Id) ON DELETE CASCADE)"
};
var dbInfo = CreateModel(sql, new List<string> { "Ranges", "Mountains" });
var fk = Assert.Single(dbInfo.Tables.Single(t => t.ForeignKeys.Count > 0).ForeignKeys);
Assert.Equal("Jet", fk.Table.Schema);
Assert.Equal("Mountains", fk.Table.Name);
Assert.Equal("Jet", fk.PrincipalTable.Schema);
Assert.Equal("Ranges", fk.PrincipalTable.Name);
Assert.Equal("RangeId", fk.Columns.Single().Name);
Assert.Equal("Id", fk.PrincipalColumns.Single().Name);
Assert.Equal(ReferentialAction.Cascade, fk.OnDelete);
}
[Fact]
public void It_reads_composite_foreign_keys()
{
var sql = new List<string> {
"CREATE TABLE Ranges1 ( Id INT IDENTITY (1,1), AltId INT, PRIMARY KEY(Id, AltId));",
"CREATE TABLE Mountains1 ( RangeId INT NOT NULL, RangeAltId INT NOT NULL, FOREIGN KEY (RangeId, RangeAltId) REFERENCES Ranges1(Id, AltId) ON DELETE NO ACTION)"
};
var dbInfo = CreateModel(sql, new List<string> { "Ranges1", "Mountains1" });
var fk = Assert.Single(dbInfo.Tables.Single(t => t.ForeignKeys.Count > 0).ForeignKeys);
Assert.Equal("Jet", fk.Table.Schema);
Assert.Equal("Mountains1", fk.Table.Name);
Assert.Equal("Jet", fk.PrincipalTable.Schema);
Assert.Equal("Ranges1", fk.PrincipalTable.Name);
Assert.Equal(new[] { "RangeId", "RangeAltId" }, fk.Columns.Select(c => c.Name).ToArray());
Assert.Equal(new[] { "Id", "AltId" }, fk.PrincipalColumns.Select(c => c.Name).ToArray());
Assert.Equal(ReferentialAction.NoAction, fk.OnDelete);
}
[Fact]
public void It_reads_primary_keys()
{
var sql = new List<string>
{
"CREATE TABLE Place1 ( Id int, Name int, Location int);",
"CREATE UNIQUE INDEX IX_Name ON Place1 (Name);",
"CREATE INDEX IX_Location_Name ON Place1 (Location, Name);",
"CREATE INDEX IX_Location ON Place1 (Location);",
"ALTER TABLE Place1 ADD CONSTRAINT PK_Place1 PRIMARY KEY (Id);"
};
var dbModel = CreateModel(sql, new List<string> { "Place1" });
var pkIndex = dbModel.Tables.Single().PrimaryKey;
Assert.Equal("Jet", pkIndex.Table.Schema);
Assert.Equal("Place1", pkIndex.Table.Name);
Assert.StartsWith("PK_Place1", pkIndex.Name);
Assert.Equal(new List<string> { "Id" }, pkIndex.Columns.Select(ic => ic.Name).ToList());
}
[Fact]
public void It_reads_unique_constraints()
{
var sql = new List<string>
{
"CREATE TABLE Place2 ( Id int PRIMARY KEY, Name int, Location int );",
"CREATE UNIQUE INDEX IX_Name ON Place2 (Name);",
"CREATE INDEX IX_Location ON Place2 (Location);"
};
var dbModel = CreateModel(sql, new List<string> { "Place2" });
var indexes = dbModel.Tables.Single().UniqueConstraints;
Assert.All(
indexes, c =>
{
Assert.Equal("Jet", c.Table.Schema);
Assert.Equal("Place2", c.Table.Name);
});
Assert.Collection(
indexes,
unique =>
{
Assert.Equal("Name", unique.Columns.Single().Name);
});
}
[Fact]
public void It_reads_indexes()
{
var sql = new List<string>
{
"CREATE TABLE Place ( Id int PRIMARY KEY, Name int, Location int );",
"CREATE UNIQUE INDEX IX_Name ON Place (Name);",
"CREATE INDEX IX_Location ON Place (Location);"
};
var dbInfo = CreateModel(sql, new List<string> { "Place" });
var indexes = dbInfo.Tables.Single().Indexes;
Assert.All(indexes, c =>
{
Assert.Equal("Jet", c.Table.Schema);
Assert.Equal("Place", c.Table.Name);
});
Assert.Collection(indexes,
nonClustered =>
{
Assert.Equal("IX_Location", nonClustered.Name);
Assert.Equal("Location", nonClustered.Columns.Select(c => c.Name).Single());
});
}
[Fact]
public void It_reads_columns()
{
var sql = @"
CREATE TABLE [MountainsColumns] (
Id int NOT NULL,
Name varchar(100) NOT NULL,
Latitude decimal( 5, 2 ) DEFAULT 0.0,
Created datetime DEFAULT #09/15/1969#,
DiscoveredDate datetime,
Modified varbinary(8),
CONSTRAINT PK_MountainsColumns PRIMARY KEY (Name, Id)
);";
var dbModel = CreateModel(new List<string>{ sql }, new List<string> { "MountainsColumns" });
var columns = dbModel.Tables.Single().Columns;
Assert.All(
columns, c =>
{
Assert.Equal("Jet", c.Table.Schema);
Assert.Equal("MountainsColumns", c.Table.Name);
});
Assert.Collection(
columns,
id =>
{
Assert.Equal("Id", id.Name);
Assert.Equal("int", id.StoreType);
Assert.False(id.IsNullable);
Assert.Null(id.DefaultValueSql);
},
name =>
{
Assert.Equal("Name", name.Name);
Assert.Equal("varchar(100)", name.StoreType);
Assert.False(name.IsNullable);
Assert.Null(name.DefaultValueSql);
},
lat =>
{
Assert.Equal("Latitude", lat.Name);
Assert.Equal("decimal(5, 2)", lat.StoreType);
Assert.True(lat.IsNullable);
Assert.Equal("0.0", lat.DefaultValueSql);
},
created =>
{
Assert.Equal("Created", created.Name);
Assert.Equal("datetime", created.StoreType);
Assert.True(created.IsNullable);
Assert.Equal("#09/15/1969#", created.DefaultValueSql);
},
discovered =>
{
Assert.Equal("DiscoveredDate", discovered.Name);
Assert.Equal("datetime", discovered.StoreType);
Assert.True(discovered.IsNullable);
Assert.Null(discovered.DefaultValueSql);
},
modified =>
{
Assert.Equal("Modified", modified.Name);
// This is a rowversion test. Rowversion is not supported by JET
//Assert.Equal(ValueGenerated.OnAddOrUpdate, modified.ValueGenerated);
Assert.Equal("varbinary(8)", modified.StoreType);
});
}
[Theory]
[InlineData("varchar(55)", 55)]
[InlineData("char(14)", 14)]
[InlineData("text", null)]
public void It_reads_max_length(string type, int? length)
{
var tables = _fixture.Query<string>("SHOW Tables WHERE Name = 'Strings'");
if (tables.Count() > 0)
{
_fixture.ExecuteNonQuery("DROP TABLE [Strings];");
}
var sql = new List<string>
{
"CREATE TABLE [Strings] ( CharColumn " + type + ");"
};
var db = CreateModel(sql, new List<string> { "Strings" });
Assert.Equal(type, db.Tables.Single().Columns.Single().StoreType);
}
[Theory]
[InlineData(true)]
[InlineData(false)]
public void It_reads_identity(bool isIdentity)
{
var tables = _fixture.Query<string>("SHOW Tables WHERE Name = 'Identities'");
if (tables.Count() > 0)
{
_fixture.ExecuteNonQuery("DROP TABLE [Identities];");
}
var sql = new List<string>
{
"CREATE TABLE [Identities] ( Id INT " + (isIdentity ? "IDENTITY(1,1)" : "") + ")"
};
var dbModel = CreateModel(sql, new List<string> { "Identities" });
var column = Assert.Single(dbModel.Tables.Single().Columns);
// ReSharper disable once AssignNullToNotNullAttribute
Assert.Equal(isIdentity ? ValueGenerated.OnAdd : default(ValueGenerated?), column.ValueGenerated);
}
[Fact]
public void It_filters_tables()
{
var sql = new List<string>
{
"CREATE TABLE [K2] ( Id int, A varchar, UNIQUE (A) );",
"CREATE TABLE [Kilimanjaro] ( Id int,B varchar, UNIQUE (B ), FOREIGN KEY (B) REFERENCES K2 (A) );"
};
var selectionSet = new List<string> { "K2" };
var dbModel = CreateModel(sql, selectionSet);
var table = Assert.Single(dbModel.Tables);
// ReSharper disable once PossibleNullReferenceException
Assert.Equal("K2", table.Name);
Assert.Equal(2, table.Columns.Count);
Assert.Equal(1, table.UniqueConstraints.Count);
Assert.Empty(table.ForeignKeys);
}
private readonly JetDatabaseModelFixture _fixture;
public DatabaseModel CreateModel(List<string> createSql, IEnumerable<string> tables = null)
=> _fixture.CreateModel(createSql, tables);
public JetDatabaseModelFactoryTest(JetDatabaseModelFixture fixture)
{
_fixture = fixture;
}
}
}

@ -1,57 +0,0 @@
using System;
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.Metadata;
using Microsoft.EntityFrameworkCore.TestUtilities;
using Microsoft.Extensions.Logging;
namespace EntityFrameworkCore.Jet.Design.FunctionalTests
{
public class JetDatabaseModelFixture : IDisposable
{
private JetTestStore _TestStore;
public TestDesignLoggerFactory TestDesignLoggerFactory { get; } = new TestDesignLoggerFactory();
public DatabaseModel CreateModel(List<string> createSql, IEnumerable<string> tables = null, ILogger logger = null)
{
foreach (var sql in createSql)
{
TestStore.ExecuteNonQuery(sql);
}
return ReadModel(tables);
}
public DatabaseModel ReadModel(IEnumerable<string> tables = null)
{
return new JetDatabaseModelFactory(
new DiagnosticsLogger<DbLoggerCategory.Scaffolding>(
TestDesignLoggerFactory,
new LoggingOptions(),
new DiagnosticListener("Fake")))
.Create(TestStore.ConnectionString, tables ?? Enumerable.Empty<string>(), Enumerable.Empty<string>());
}
public IEnumerable<T> Query<T>(string sql, params object[] parameters) => TestStore.Query<T>(sql, parameters);
public virtual JetTestStore TestStore
{
get
{
if (_TestStore == null)
_TestStore = JetTestStore.CreateScratch(true);
return _TestStore;
}
}
public void ExecuteNonQuery(string sql) => TestStore.ExecuteNonQuery(sql);
public void Dispose() => TestStore.Dispose();
}
}

@ -1,31 +0,0 @@
using System;
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.Metadata;
using Microsoft.EntityFrameworkCore.TestUtilities;
using Microsoft.Extensions.Logging;
namespace EntityFrameworkCore.Jet.Design.FunctionalTests
{
public class JetDatabaseModelIssue4Fixture : JetDatabaseModelFixture
{
private JetTestStore _TestStore;
public override JetTestStore TestStore
{
get
{
if (_TestStore == null)
_TestStore = JetTestStore.Create("Issue_4.mdb");
return _TestStore;
}
}
}
}

@ -1,4 +0,0 @@
using System.Reflection;
[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")]

@ -1,170 +0,0 @@
using System;
using EntityFrameworkCore.Jet.Storage.Internal;
using Microsoft.EntityFrameworkCore.Scaffolding.Internal;
using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.EntityFrameworkCore.TestUtilities;
using Xunit;
namespace EntityFrameworkCore.Jet.Design.FunctionalTests
{
public class ScaffoldingTypeMapperJetTest
{
[Theory]
[InlineData(false)]
[InlineData(true)]
public void Maps_int_column(bool isKeyOrIndex)
{
var mapping = CreateMapper().FindMapping("int", isKeyOrIndex, rowVersion: false);
AssertMapping<int>(mapping, inferred: true, maxLength: null, unicode: null);
}
[Theory]
[InlineData(false)]
[InlineData(true)]
public void Maps_bit_column(bool isKeyOrIndex)
{
var mapping = CreateMapper().FindMapping("bit", isKeyOrIndex, rowVersion: false);
AssertMapping<bool>(mapping, inferred: false, maxLength: null, unicode: null);
}
[Theory]
[InlineData(false)]
[InlineData(true)]
public void Maps_datetime_column(bool isKeyOrIndex)
{
var mapping = CreateMapper().FindMapping("datetime", isKeyOrIndex, rowVersion: false);
AssertMapping<DateTime>(mapping, inferred: true, maxLength: null, unicode: null);
}
[Fact]
public void Maps_normal_varbinary_max_column()
{
var mapping = CreateMapper().FindMapping("image", keyOrIndex: false, rowVersion: false);
AssertMapping<byte[]>(mapping, inferred: true, maxLength: null, unicode: null);
}
[Fact]
public void Maps_normal_varbinary_sized_column()
{
var mapping = CreateMapper().FindMapping("varbinary(200)", keyOrIndex: false, rowVersion: false);
AssertMapping<byte[]>(mapping, inferred: true, maxLength: 200, unicode: null);
}
[Fact]
public void Maps_normal_binary_max_column()
{
var mapping = CreateMapper().FindMapping("binary(8000)", keyOrIndex: false, rowVersion: false);
AssertMapping<byte[]>(mapping, inferred: false, maxLength: null, unicode: null);
}
[Fact]
public void Maps_normal_binary_sized_column()
{
var mapping = CreateMapper().FindMapping("binary(200)", keyOrIndex: false, rowVersion: false);
AssertMapping<byte[]>(mapping, inferred: false, maxLength: null, unicode: null);
}
[Fact]
public void Maps_key_varbinary_max_column()
{
var mapping = CreateMapper().FindMapping("image", keyOrIndex: true, rowVersion: false);
AssertMapping<byte[]>(mapping, inferred: false, maxLength: null, unicode: null);
}
[Fact]
public void Maps_key_varbinary_sized_column()
{
var mapping = CreateMapper().FindMapping("varbinary(200)", keyOrIndex: true, rowVersion: false);
AssertMapping<byte[]>(mapping, inferred: true, maxLength: 200, unicode: null);
}
[Fact]
public void Maps_key_varbinary_default_sized_column()
{
var mapping = CreateMapper().FindMapping("varbinary(510)", keyOrIndex: true, rowVersion: false);
AssertMapping<byte[]>(mapping, inferred: true, maxLength: null, unicode: null);
}
[Fact]
public void Maps_key_binary_max_column()
{
var mapping = CreateMapper().FindMapping("image", keyOrIndex: true, rowVersion: false);
AssertMapping<byte[]>(mapping, inferred: false, maxLength: null, unicode: null);
}
[Fact]
public void Maps_key_binary_sized_column()
{
var mapping = CreateMapper().FindMapping("binary(200)", keyOrIndex: true, rowVersion: false);
AssertMapping<byte[]>(mapping, inferred: false, maxLength: null, unicode: null);
}
[Fact]
public void Maps_key_binary_default_sized_column()
{
var mapping = CreateMapper().FindMapping("binary(512)", keyOrIndex: true, rowVersion: false);
AssertMapping<byte[]>(mapping, inferred: false, maxLength: null, unicode: null);
}
[Fact]
public void Maps_normal_varchar_sized_column()
{
var mapping = CreateMapper().FindMapping("varchar(200)", keyOrIndex: false, rowVersion: false);
AssertMapping<string>(mapping, inferred: true, maxLength: 200, unicode: null);
}
[Fact]
public void Maps_key_varchar_max_column()
{
var mapping = CreateMapper().FindMapping("text", keyOrIndex: true, rowVersion: false);
AssertMapping<string>(mapping, inferred: false, maxLength: null, unicode: null);
}
[Fact]
public void Maps_key_varchar_sized_column()
{
var mapping = CreateMapper().FindMapping("varchar(200)", keyOrIndex: true, rowVersion: false);
AssertMapping<string>(mapping, inferred: true, maxLength: 200, unicode: null);
}
[Fact]
public void Maps_key_varchar_default_sized_column()
{
var mapping = CreateMapper().FindMapping("varchar(255)", keyOrIndex: true, rowVersion: false);
AssertMapping<string>(mapping, inferred: true, maxLength: null, unicode: null);
}
private static void AssertMapping<T>(TypeScaffoldingInfo mapping, bool inferred, int? maxLength, bool? unicode)
{
Assert.Same(typeof(T), mapping.ClrType);
Assert.Equal(inferred, mapping.IsInferred);
Assert.Equal(maxLength, mapping.ScaffoldMaxLength);
Assert.Equal(unicode, mapping.ScaffoldUnicode);
}
private static ScaffoldingTypeMapper CreateMapper()
=> new ScaffoldingTypeMapper(
new JetTypeMappingSource(
TestServiceFactory.Instance.Create<TypeMappingSourceDependencies>(),
TestServiceFactory.Instance.Create<RelationalTypeMappingSourceDependencies>()));
}
}

@ -1,123 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.2.3.0" newVersion="1.2.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Data.Common" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Reflection.Metadata" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.4.3.0" newVersion="1.4.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Xml.ReaderWriter" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.1" newVersion="4.0.3.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" />
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Security.Cryptography.Algorithms" publicKeyToken="b03f5f7f11d50a3a" />
<bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.IO.FileSystem" publicKeyToken="b03f5f7f11d50a3a" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.IO.Compression.FileSystem" publicKeyToken="b03f5f7f11d50a3a" />
<bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.ComponentModel.Annotations" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.1.0" newVersion="4.2.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Text.Encoding.CodePages" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.10.0.0" newVersion="2.10.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.CSharp" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.10.0.0" newVersion="2.10.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Logging.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.EntityFrameworkCore" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.EntityFrameworkCore.Design" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.DependencyInjection.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.DependencyInjection" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="xunit.assert" publicKeyToken="8d05b1bb7a6fdb6c" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.4.1.0" newVersion="2.4.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="xunit.core" publicKeyToken="8d05b1bb7a6fdb6c" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.4.1.0" newVersion="2.4.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Logging" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.EntityFrameworkCore.Relational" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.4.0" newVersion="4.1.4.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.InteropServices.RuntimeInformation" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.4.1" newVersion="4.0.4.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.IO.FileSystem.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="xunit.execution.desktop" publicKeyToken="8d05b1bb7a6fdb6c" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.4.1.0" newVersion="2.4.1.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
Loading…
Cancel
Save