Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run two SaveChanges interception suites against different databases #21880

Merged
1 commit merged into from
Jul 31, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ protected SaveChangesInterceptionSqlServerTestBase(InterceptionSqlServerFixtureB

public abstract class InterceptionSqlServerFixtureBase : InterceptionFixtureBase
{
protected override string StoreName => "SaveChangesInterception";

protected override ITestStoreFactory TestStoreFactory => SqlServerTestStoreFactory.Instance;

protected override IServiceCollection InjectInterceptors(
Expand All @@ -30,7 +28,7 @@ protected override IServiceCollection InjectInterceptors(
=> base.InjectInterceptors(serviceCollection.AddEntityFrameworkSqlServer(), injectedInterceptors);
}

internal class SaveChangesInterceptionSqlServerTest
public class SaveChangesInterceptionSqlServerTest
: SaveChangesInterceptionSqlServerTestBase, IClassFixture<SaveChangesInterceptionSqlServerTest.InterceptionSqlServerFixture>
{
public SaveChangesInterceptionSqlServerTest(InterceptionSqlServerFixture fixture)
Expand All @@ -40,6 +38,8 @@ public SaveChangesInterceptionSqlServerTest(InterceptionSqlServerFixture fixture

public class InterceptionSqlServerFixture : InterceptionSqlServerFixtureBase
{
protected override string StoreName => "SaveChangesInterception";

protected override bool ShouldSubscribeToDiagnosticListener => false;

public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder)
Expand All @@ -51,7 +51,7 @@ public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder build
}
}

internal class SaveChangesInterceptionWithDiagnosticsSqlServerTest
public class SaveChangesInterceptionWithDiagnosticsSqlServerTest
: SaveChangesInterceptionSqlServerTestBase,
IClassFixture<SaveChangesInterceptionWithDiagnosticsSqlServerTest.InterceptionSqlServerFixture>
{
Expand All @@ -62,6 +62,8 @@ public SaveChangesInterceptionWithDiagnosticsSqlServerTest(InterceptionSqlServer

public class InterceptionSqlServerFixture : InterceptionSqlServerFixtureBase
{
protected override string StoreName => "SaveChangesInterceptionWithDiagnostics";

protected override bool ShouldSubscribeToDiagnosticListener => true;

public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
// 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 System.Collections.Generic;
using System.Reflection;

namespace Microsoft.EntityFrameworkCore
{
public class SqlServerComplianceTest : RelationalComplianceTestBase
{
protected override ICollection<Type> IgnoredTestBases => new List<Type>
{
typeof(SaveChangesInterceptionTestBase)
};

protected override Assembly TargetAssembly { get; } = typeof(SqlServerComplianceTest).Assembly;
}
}