Skip to content

Commit edeb0f7

Browse files
committed
Update deps and removed Moq
1 parent 4098ab5 commit edeb0f7

File tree

20 files changed

+73
-81
lines changed

20 files changed

+73
-81
lines changed

samples/Thinktecture.EntityFrameworkCore.Benchmarks/Thinktecture.EntityFrameworkCore.Benchmarks.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</ItemGroup>
1313

1414
<ItemGroup>
15-
<PackageReference Include="BenchmarkDotNet" Version="0.13.5" />
15+
<PackageReference Include="BenchmarkDotNet" Version="0.13.8" />
1616
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
1717
</ItemGroup>
1818

samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
</ItemGroup>
1818

1919
<ItemGroup>
20-
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.5" PrivateAssets="all" />
20+
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.11" PrivateAssets="all" />
2121
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
2222
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="7.0.0" />
2323
</ItemGroup>

samples/Thinktecture.EntityFrameworkCore.Sqlite.Samples/Thinktecture.EntityFrameworkCore.Sqlite.Samples.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
</ItemGroup>
1414

1515
<ItemGroup>
16-
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.5" PrivateAssets="all" />
16+
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.11" PrivateAssets="all" />
1717
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
1818
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="7.0.0" />
1919
</ItemGroup>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<ItemGroup>
4-
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="7.0.5" />
5-
<PackageReference Include="Microsoft.Extensions.ObjectPool" Version="7.0.5" />
4+
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="7.0.11" />
5+
<PackageReference Include="Microsoft.Extensions.ObjectPool" Version="7.0.11" />
66
</ItemGroup>
77

88
</Project>

src/Thinktecture.EntityFrameworkCore.SqlServer/Thinktecture.EntityFrameworkCore.SqlServer.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<ItemGroup>
88
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.1.1" />
9-
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.5" />
9+
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.11" />
1010
</ItemGroup>
1111

1212
</Project>

src/Thinktecture.EntityFrameworkCore.Sqlite/Thinktecture.EntityFrameworkCore.Sqlite.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
</ItemGroup>
66

77
<ItemGroup>
8-
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.5" />
8+
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.11" />
99
</ItemGroup>
1010

1111
</Project>

tests/Directory.Build.props

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@
99
<Import Condition="exists('$(ParentPropsFile)') " Project="$(ParentPropsFile)" />
1010

1111
<ItemGroup>
12-
<PackageReference Include="FluentAssertions" Version="6.11.0" />
13-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.0" />
14-
<PackageReference Include="Moq" Version="4.18.4" />
12+
<PackageReference Include="FluentAssertions" Version="6.12.0" />
13+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
14+
<PackageReference Include="NSubstitute" Version="5.1.0" />
1515
<PackageReference Include="Serilog.Extensions.Logging" Version="7.0.0" />
1616
<PackageReference Include="Serilog.Sinks.XUnit" Version="3.0.5" />
17-
<PackageReference Include="xunit" Version="2.4.2" />
18-
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5" PrivateAssets="all" />
17+
<PackageReference Include="xunit" Version="2.5.0" />
18+
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0" PrivateAssets="all" />
1919
</ItemGroup>
2020

2121
<ItemGroup>
2222
<Using Include="FluentAssertions" />
23-
<Using Include="Moq" />
23+
<Using Include="NSubstitute" />
2424
<Using Include="Xunit" />
2525
<Using Include="Xunit.Abstractions" />
2626
</ItemGroup>

tests/Thinktecture.EntityFrameworkCore.BulkOperations.Tests/Thinktecture.EntityFrameworkCore.BulkOperations.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
</ItemGroup>
1010

1111
<ItemGroup>
12-
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.5" />
12+
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.11" />
1313
</ItemGroup>
1414

1515
</Project>

tests/Thinktecture.EntityFrameworkCore.Relational.Tests/EntityFrameworkCore/Infrastructure/DefaultSchemaRespectingModelCacheKeyFactoryTests/TestModelCacheKeyFactory.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ namespace Thinktecture.EntityFrameworkCore.Infrastructure.DefaultSchemaRespectin
44

55
public class TestModelCacheKeyFactory : IModelCacheKeyFactory
66
{
7-
public Mock<IModelCacheKeyFactory> Mock { get; }
7+
public IModelCacheKeyFactory Mock { get; }
88

99
public TestModelCacheKeyFactory()
1010
{
11-
Mock = new Mock<IModelCacheKeyFactory>();
12-
Mock.Setup(f => f.Create(It.IsAny<DbContext>(), It.IsAny<bool>())).Returns<DbContext, bool>((ctx, designTime) => new ModelCacheKey(ctx, designTime));
11+
Mock = Substitute.For<IModelCacheKeyFactory>();
12+
Mock.Create(Arg.Any<DbContext>(), Arg.Any<bool>()).Returns(x => new ModelCacheKey((DbContext)x[0], (bool)x[1]));
1313
}
1414

1515
public object Create(DbContext context)
@@ -19,6 +19,6 @@ public object Create(DbContext context)
1919

2020
public object Create(DbContext context, bool designTime)
2121
{
22-
return Mock.Object.Create(context, designTime);
22+
return Mock.Create(context, designTime);
2323
}
2424
}

tests/Thinktecture.EntityFrameworkCore.Relational.Tests/EntityFrameworkCore/Migrations/DefaultSchemaRespectingMigrationAssemblyTests/CreateMigration.cs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public CreateMigration(ITestOutputHelper testOutputHelper)
1515
[Fact]
1616
public void Should_throw_when_schema_type_is_null()
1717
{
18-
CurrentCtxMock.Setup(c => c.Context).Returns(CreateContextWithSchema("Schema1"));
18+
CurrentCtxMock.Context.Returns(CreateContextWithSchema("Schema1"));
1919

2020
// ReSharper disable once AssignNullToNotNullAttribute
2121
SUT.Invoking(sut => sut.CreateMigration(null!, "DummyProvider"))
@@ -25,7 +25,7 @@ public void Should_throw_when_schema_type_is_null()
2525
[Fact]
2626
public void Should_throw_when_active_provider_is_null()
2727
{
28-
CurrentCtxMock.Setup(c => c.Context).Returns(CreateContextWithSchema("Schema1"));
28+
CurrentCtxMock.Context.Returns(CreateContextWithSchema("Schema1"));
2929

3030
// ReSharper disable once AssignNullToNotNullAttribute
3131
SUT.Invoking(sut => sut.CreateMigration(typeof(MigrationWithSchema).GetTypeInfo(), null!))
@@ -35,7 +35,7 @@ public void Should_throw_when_active_provider_is_null()
3535
[Fact]
3636
public void Should_create_schema_aware_migration_having_schema_aware_ctx()
3737
{
38-
CurrentCtxMock.Setup(c => c.Context).Returns(CreateContextWithSchema("Schema1"));
38+
CurrentCtxMock.Context.Returns(CreateContextWithSchema("Schema1"));
3939

4040
var migration = SUT.CreateMigration(typeof(MigrationWithSchema).GetTypeInfo(), "DummyProvider");
4141

@@ -46,9 +46,9 @@ public void Should_create_schema_aware_migration_having_schema_aware_ctx()
4646
[Fact]
4747
public void Should_set_schema_of_schema_aware_migration_having_schema_aware_ctx()
4848
{
49-
CurrentCtxMock.Setup(c => c.Context).Returns(CreateContextWithSchema("Schema1"));
50-
SchemaSetterMock.Setup(s => s.SetSchema(It.IsAny<IReadOnlyList<MigrationOperation>>(), It.IsAny<string>()))
51-
.Callback<IReadOnlyList<MigrationOperation>, string>((ops, schema) => new MigrationOperationSchemaSetter().SetSchema(ops, schema));
49+
CurrentCtxMock.Context.Returns(CreateContextWithSchema("Schema1"));
50+
SchemaSetterMock.When(s => s.SetSchema(Arg.Any<IReadOnlyList<MigrationOperation>>(), Arg.Any<string>()))
51+
.Do(x => new MigrationOperationSchemaSetter().SetSchema((IReadOnlyList<MigrationOperation>)x[0], (string)x[1]));
5252

5353
var migration = SUT.CreateMigration(typeof(MigrationWithSchema).GetTypeInfo(), "DummyProvider");
5454

@@ -58,7 +58,7 @@ public void Should_set_schema_of_schema_aware_migration_having_schema_aware_ctx(
5858
[Fact]
5959
public void Should_create_migration_having_schema_aware_ctx()
6060
{
61-
CurrentCtxMock.Setup(c => c.Context).Returns(CreateContextWithSchema("Schema1"));
61+
CurrentCtxMock.Context.Returns(CreateContextWithSchema("Schema1"));
6262
var migration = new MigrationWithoutSchema { ActiveProvider = "DummyProvider" };
6363

6464
var createMigration = SUT.CreateMigration(typeof(MigrationWithoutSchema).GetTypeInfo(), "DummyProvider");
@@ -72,9 +72,9 @@ public void Should_create_migration_having_schema_aware_ctx()
7272
[Fact]
7373
public void Should_set_schema_of_migration_having_schema_aware_ctx()
7474
{
75-
CurrentCtxMock.Setup(c => c.Context).Returns(CreateContextWithSchema("Schema1"));
76-
SchemaSetterMock.Setup(s => s.SetSchema(It.IsAny<IReadOnlyList<MigrationOperation>>(), It.IsAny<string>()))
77-
.Callback<IReadOnlyList<MigrationOperation>, string>((ops, schema) => new MigrationOperationSchemaSetter().SetSchema(ops, schema));
75+
CurrentCtxMock.Context.Returns(CreateContextWithSchema("Schema1"));
76+
SchemaSetterMock.When(s => s.SetSchema(Arg.Any<IReadOnlyList<MigrationOperation>>(), Arg.Any<string>()))
77+
.Do(x => new MigrationOperationSchemaSetter().SetSchema((IReadOnlyList<MigrationOperation>)x[0], (string)x[1]));
7878

7979
var migration = SUT.CreateMigration(typeof(MigrationWithoutSchema).GetTypeInfo(), "DummyProvider");
8080

@@ -84,7 +84,7 @@ public void Should_set_schema_of_migration_having_schema_aware_ctx()
8484
[Fact]
8585
public void Should_throw_when_creating_schema_aware_migration_having_schema_unaware_ctx()
8686
{
87-
CurrentCtxMock.Setup(c => c.Context).Returns(CreateContextWithoutSchema());
87+
CurrentCtxMock.Context.Returns(CreateContextWithoutSchema());
8888

8989
SUT.Invoking(sut => sut.CreateMigration(typeof(MigrationWithSchema).GetTypeInfo(), "DummyProvider"))
9090
.Should().Throw<ArgumentException>().WithMessage($@"For instantiation of default schema respecting migration of type '{nameof(MigrationWithSchema)}' the database context of type '{nameof(DbContextWithoutSchema)}' has to implement the interface '{nameof(IDbDefaultSchema)}'. (Parameter 'migrationClass')");
@@ -93,7 +93,7 @@ public void Should_throw_when_creating_schema_aware_migration_having_schema_unaw
9393
[Fact]
9494
public void Should_create_schema_unaware_migration_having_schema_unaware_ctx()
9595
{
96-
CurrentCtxMock.Setup(c => c.Context).Returns(CreateContextWithoutSchema());
96+
CurrentCtxMock.Context.Returns(CreateContextWithoutSchema());
9797
var migration = new MigrationWithoutSchema { ActiveProvider = "DummyProvider" };
9898

9999
var createMigration = SUT.CreateMigration(typeof(MigrationWithoutSchema).GetTypeInfo(), "DummyProvider");
@@ -104,19 +104,19 @@ public void Should_create_schema_unaware_migration_having_schema_unaware_ctx()
104104
[Fact]
105105
public void Should_not_set_schema_on_schema_unaware_migration_having_schema_unaware_ctx()
106106
{
107-
CurrentCtxMock.Setup(c => c.Context).Returns(CreateContextWithoutSchema());
107+
CurrentCtxMock.Context.Returns(CreateContextWithoutSchema());
108108

109109
var migration = SUT.CreateMigration(typeof(MigrationWithoutSchema).GetTypeInfo(), "DummyProvider");
110110

111-
SchemaSetterMock.Verify(s => s.SetSchema(It.IsAny<IReadOnlyList<MigrationOperation>>(), It.IsAny<string>()), Times.Never);
111+
SchemaSetterMock.DidNotReceive().SetSchema(Arg.Any<IReadOnlyList<MigrationOperation>>(), Arg.Any<string>());
112112
migration.UpOperations[0].Should().BeOfType<AddColumnOperation>().Subject.Schema.Should().BeNull();
113113
migration.DownOperations[0].Should().BeOfType<DropColumnOperation>().Subject.Schema.Should().BeNull();
114114
}
115115

116116
private void VerifySchema(Migration migration, string schema)
117117
{
118-
SchemaSetterMock.Verify(s => s.SetSchema(migration.UpOperations, schema), Times.Once);
119-
SchemaSetterMock.Verify(s => s.SetSchema(migration.DownOperations, schema), Times.Once);
118+
SchemaSetterMock.Received(1).SetSchema(migration.UpOperations, schema);
119+
SchemaSetterMock.Received(1).SetSchema(migration.DownOperations, schema);
120120

121121
migration.UpOperations[0].Should().BeOfType<AddColumnOperation>().Subject.Schema.Should().Be(schema);
122122
migration.DownOperations[0].Should().BeOfType<DropColumnOperation>().Subject.Schema.Should().Be(schema);

0 commit comments

Comments
 (0)