-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix for 20741. Allow older versions of tools to pass null args.
- Loading branch information
Showing
8 changed files
with
151 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
test/EFCore.Design.Tests/Design/Internal/DatabaseOperationsTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// 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; | ||
using Xunit; | ||
|
||
namespace Microsoft.EntityFrameworkCore.Design.Internal | ||
{ | ||
public class DatabaseOperationsTest | ||
{ | ||
[ConditionalFact] | ||
public void Can_pass_null_args() | ||
{ | ||
// Even though newer versions of the tools will pass an empty array | ||
// older versions of the tools can pass null args. | ||
var assembly = MockAssembly.Create(typeof(TestContext)); | ||
_ = new TestDatabaseOperations( | ||
new TestOperationReporter(), | ||
assembly, | ||
assembly, | ||
"projectDir", | ||
"RootNamespace", | ||
"C#", | ||
args: null); | ||
} | ||
|
||
private class TestContext : DbContext | ||
{ | ||
public TestContext() | ||
{ | ||
throw new Exception("This isn't the constructor you're looking for."); | ||
} | ||
|
||
public TestContext(DbContextOptions<TestContext> options) | ||
: base(options) | ||
{ | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
test/EFCore.Design.Tests/Design/Internal/MigrationsOperationsTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// 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; | ||
using Xunit; | ||
|
||
namespace Microsoft.EntityFrameworkCore.Design.Internal | ||
{ | ||
public class MigrationsOperationsTest | ||
{ | ||
[ConditionalFact] | ||
public void Can_pass_null_args() | ||
{ | ||
// Even though newer versions of the tools will pass an empty array | ||
// older versions of the tools can pass null args. | ||
var assembly = MockAssembly.Create(typeof(TestContext)); | ||
_ = new TestMigrationsOperations( | ||
new TestOperationReporter(), | ||
assembly, | ||
assembly, | ||
"projectDir", | ||
"RootNamespace", | ||
"C#", | ||
args: null); | ||
} | ||
|
||
private class TestContext : DbContext | ||
{ | ||
public TestContext() | ||
{ | ||
throw new Exception("This isn't the constructor you're looking for."); | ||
} | ||
|
||
public TestContext(DbContextOptions<TestContext> options) | ||
: base(options) | ||
{ | ||
} | ||
} | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
test/EFCore.Design.Tests/TestUtilities/TestDatabaseOperations.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// 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.Reflection; | ||
using Microsoft.EntityFrameworkCore.Design.Internal; | ||
|
||
namespace Microsoft.EntityFrameworkCore.TestUtilities | ||
{ | ||
public class TestDatabaseOperations : DatabaseOperations | ||
{ | ||
public TestDatabaseOperations( | ||
IOperationReporter reporter, | ||
Assembly assembly, | ||
Assembly startupAssembly, | ||
string projectDir, | ||
string rootNamespace, | ||
string language, | ||
string[] args) | ||
: base(reporter, assembly, startupAssembly, projectDir,rootNamespace, language, args) | ||
{ | ||
} | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
test/EFCore.Design.Tests/TestUtilities/TestMigrationsOperations.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// 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.Reflection; | ||
using Microsoft.EntityFrameworkCore.Design.Internal; | ||
|
||
namespace Microsoft.EntityFrameworkCore.TestUtilities | ||
{ | ||
public class TestMigrationsOperations : MigrationsOperations | ||
{ | ||
public TestMigrationsOperations( | ||
IOperationReporter reporter, | ||
Assembly assembly, | ||
Assembly startupAssembly, | ||
string projectDir, | ||
string rootNamespace, | ||
string language, | ||
string[] args) | ||
: base(reporter, assembly, startupAssembly, projectDir,rootNamespace, language, args) | ||
{ | ||
} | ||
} | ||
} |