Skip to content

Commit

Permalink
Added some infrastructure and coverage for ASP.NET models
Browse files Browse the repository at this point in the history
Would have allowed us to catch issues like dotnet/aspnetcore#12097

Part of #11838

Ideally, we should reference the actual "product" assemblies, but this requires changes to dependencies that I don't want to take on write now. #11838 is still open to track improvements.

I intend to add some more tests here before 3.0 to get some more coverage.
  • Loading branch information
ajcvickers committed Jul 11, 2019
1 parent aec9bcf commit 4c0cb15
Show file tree
Hide file tree
Showing 32 changed files with 1,292 additions and 5,195 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class InMemoryComplianceTest : ComplianceTestBase
typeof(OptimisticConcurrencyTestBase<>),
typeof(StoreGeneratedTestBase<>),
typeof(LoadTestBase<>), // issue #15318
typeof(MusicStoreTestBase<>), // issue #15318
typeof(GraphUpdatesTestBase<>), // issue #15318
typeof(ProxyGraphUpdatesTestBase<>), // issue #15318
typeof(ComplexNavigationsWeakQueryTestBase<>), // issue #15285
Expand Down
31 changes: 31 additions & 0 deletions test/EFCore.InMemory.FunctionalTests/MusicStoreInMemoryTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using Microsoft.EntityFrameworkCore.TestUtilities;

namespace Microsoft.EntityFrameworkCore
{
// issue #15318
internal class MusicStoreInMemoryTest : MusicStoreTestBase<MusicStoreInMemoryTest.MusicStoreInMemoryFixture>
{
public MusicStoreInMemoryTest(MusicStoreInMemoryFixture fixture)
: base(fixture)
{
}

public class MusicStoreInMemoryFixture : MusicStoreFixtureBase
{
protected override ITestStoreFactory TestStoreFactory => InMemoryTestStoreFactory.Instance;

public override IDisposable BeginTransaction(DbContext context) => new InMemoryCleaner(context);

private class InMemoryCleaner : IDisposable
{
private readonly DbContext _context;
public InMemoryCleaner(DbContext context) => _context = context;
public void Dispose() => _context.Database.EnsureDeleted();
}
}
}
}
Loading

0 comments on commit 4c0cb15

Please sign in to comment.