Skip to content

Commit

Permalink
Run dependency object tests automatically for all dependency objects
Browse files Browse the repository at this point in the history
Part of #20409
  • Loading branch information
ajcvickers committed Apr 19, 2020
1 parent e6ca080 commit d46f7cc
Show file tree
Hide file tree
Showing 57 changed files with 201 additions and 807 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ public StateManagerDependencies With([NotNull] IInternalEntityEntryNotifier inte
/// </summary>
/// <param name="valueGenerationManager"> A replacement for the current dependency of this type. </param>
/// <returns> A new parameter object with the given service replaced. </returns>
public StateManagerDependencies With([NotNull] ValueGenerationManager valueGenerationManager)
public StateManagerDependencies With([NotNull] IValueGenerationManager valueGenerationManager)
=> new StateManagerDependencies(
InternalEntityEntryFactory,
InternalEntityEntrySubscriber,
Expand Down
8 changes: 7 additions & 1 deletion test/EFCore.Cosmos.Tests/CosmosApiConsistencyTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Collections.Generic;
using System.Reflection;
using Microsoft.EntityFrameworkCore.Cosmos.Storage.Internal;
using Microsoft.EntityFrameworkCore.Cosmos.TestUtilities;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.Extensions.DependencyInjection;
Expand All @@ -19,8 +20,13 @@ public CosmosApiConsistencyTest(CosmosApiConsistencyFixture fixture)
}

protected override void AddServices(ServiceCollection serviceCollection)
=> serviceCollection.AddEntityFrameworkCosmos();

protected override bool TryGetProviderOptionsDelegate(out Action<DbContextOptionsBuilder> configureOptions)
{
serviceCollection.AddEntityFrameworkCosmos();
configureOptions = b => b.UseCosmos(TestEnvironment.DefaultConnection, TestEnvironment.AuthToken, "CosmosApiConsistencyTest");

return true;
}

protected override Assembly TargetAssembly => typeof(CosmosDatabaseWrapper).Assembly;
Expand Down
7 changes: 7 additions & 0 deletions test/EFCore.Design.Tests/DesignApiConsistencyTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ protected override void AddServices(ServiceCollection serviceCollection)
{
}

protected override bool TryGetProviderOptionsDelegate(out Action<DbContextOptionsBuilder> configureOptions)
{
configureOptions = b => b.UseInMemoryDatabase(nameof(DesignApiConsistencyTest));

return true;
}

protected override Assembly TargetAssembly => typeof(OperationExecutor).Assembly;

public class DesignApiConsistencyFixture : ApiConsistencyFixtureBase
Expand Down
7 changes: 6 additions & 1 deletion test/EFCore.InMemory.Tests/InMemoryApiConsistencyTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,13 @@ public InMemoryApiConsistencyTest(InMemoryApiConsistencyFixture fixture)
}

protected override void AddServices(ServiceCollection serviceCollection)
=> serviceCollection.AddEntityFrameworkInMemoryDatabase();

protected override bool TryGetProviderOptionsDelegate(out Action<DbContextOptionsBuilder> configureOptions)
{
serviceCollection.AddEntityFrameworkInMemoryDatabase();
configureOptions = b => b.UseInMemoryDatabase(nameof(InMemoryApiConsistencyTest));

return true;
}

protected override Assembly TargetAssembly => typeof(InMemoryDatabase).Assembly;
Expand Down
7 changes: 6 additions & 1 deletion test/EFCore.Proxies.Tests/ProxiesApiConsistencyTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,13 @@ public ProxiesApiConsistencyTest(ProxiesApiConsistencyFixture fixture)
}

protected override void AddServices(ServiceCollection serviceCollection)
=> serviceCollection.AddEntityFrameworkProxies();

protected override bool TryGetProviderOptionsDelegate(out Action<DbContextOptionsBuilder> configureOptions)
{
serviceCollection.AddEntityFrameworkProxies();
configureOptions = b => b.UseInMemoryDatabase(nameof(ProxiesApiConsistencyTest));

return true;
}

protected override Assembly TargetAssembly => typeof(ProxiesExtensions).Assembly;
Expand Down
4 changes: 4 additions & 0 deletions test/EFCore.Relational.Tests/EFCore.Relational.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,8 @@
<Compile Update="TestUtilities\FakeProvider\FakeDbConnection.cs" />
</ItemGroup>

<ItemGroup>
<Folder Include="Query" />
</ItemGroup>

</Project>

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

7 changes: 5 additions & 2 deletions test/EFCore.Relational.Tests/RelationalApiConsistencyTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,13 @@ public RelationalApiConsistencyTest(RelationalApiConsistencyFixture fixture)
{
}


protected override void AddServices(ServiceCollection serviceCollection)
=> new EntityFrameworkRelationalServicesBuilder(serviceCollection).TryAddCoreServices();

protected override bool TryGetProviderOptionsDelegate(out Action<DbContextOptionsBuilder> configureOptions)
{
new EntityFrameworkRelationalServicesBuilder(serviceCollection).TryAddCoreServices();
configureOptions = null;
return false;
}

protected override Assembly TargetAssembly => typeof(RelationalDatabase).Assembly;
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit d46f7cc

Please sign in to comment.