Skip to content

Commit f098836

Browse files
committed
Enlarge an xUnit collection to include all ModelMetadataProviders.Current readers
- #41 - have not seen similar `InvalidOperationException`s in other test classes - `DisplayExtensionsTest` and `EditorExtensionsTest` are already in this increasingly-poorly named collection - they temporarily change `ModelMetadataProviders.Current` to reference a `Mock<ModelMetadataProvider>` This is a **temporary** fix: should use `[CollectionDefinition(DisableParallelization = true)]` xUnit v2.3.0 - i.e. create an isolated collection containing just `DisplayExtensionsTest` and `EditorExtensionsTest`
1 parent d86dda5 commit f098836

20 files changed

+22
-4
lines changed

test/System.Web.Mvc.Test/Html/Test/DefaultDisplayTemplatesTest.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
namespace System.Web.Mvc.Html.Test
1515
{
16+
[Xunit.Collection("Uses ScopeStorage or ViewEngines.Engines")] // Uses ModelMetadataProviders.Current
1617
public class DefaultDisplayTemplatesTest
1718
{
1819
// BooleanTemplate

test/System.Web.Mvc.Test/Test/AssociatedValidatorProviderTest.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
namespace System.Web.Mvc.Test
1111
{
12+
[Xunit.Collection("Uses ScopeStorage or ViewEngines.Engines")] // Uses ModelMetadataProviders.Current
1213
public class AssociatedValidatorProviderTest
1314
{
1415
[Fact]

test/System.Web.Mvc.Test/Test/CompareAttributeAdapterTest.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
namespace System.Web.Mvc.Test
1111
{
12+
[Xunit.Collection("Uses ScopeStorage or ViewEngines.Engines")] // Uses ModelMetadataProviders.Current
1213
public class CompareAttributeAdapterTest
1314
{
1415
[Fact]

test/System.Web.Mvc.Test/Test/CompareAttributeTest.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
namespace System.Web.Mvc.Test
1010
{
11+
[Xunit.Collection("Uses ScopeStorage or ViewEngines.Engines")] // Uses ModelMetadataProviders.Current
1112
public class CompareAttributeTest
1213
{
1314
[Fact]

test/System.Web.Mvc.Test/Test/ControllerActionInvokerTest.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
namespace System.Web.Mvc.Test
2020
{
21+
[Xunit.Collection("Uses ScopeStorage or ViewEngines.Engines")] // Uses ModelMetadataProviders.Current
2122
public class ControllerActionInvokerTest
2223
{
2324
[Fact]

test/System.Web.Mvc.Test/Test/DataAnnotationsModelValidatorProviderTest.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace System.Web.Mvc.Test
1313
{
14+
[Xunit.Collection("Uses ScopeStorage or ViewEngines.Engines")] // Uses ModelMetadataProviders.Current
1415
public class DataAnnotationsModelValidatorProviderTest
1516
{
1617
// Validation attribute adapter registration

test/System.Web.Mvc.Test/Test/DataAnnotationsModelValidatorTest.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
namespace System.Web.Mvc.Test
1212
{
13+
[Xunit.Collection("Uses ScopeStorage or ViewEngines.Engines")] // Uses ModelMetadataProviders.Current
1314
public class DataAnnotationsModelValidatorTest
1415
{
1516
[Fact]

test/System.Web.Mvc.Test/Test/DefaultModelBinderTest.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
namespace System.Web.Mvc.Test
1717
{
18+
[Xunit.Collection("Uses ScopeStorage or ViewEngines.Engines")] // Uses ModelMetadataProviders.Current
1819
public class DefaultModelBinderTest
1920
{
2021
[Fact]

test/System.Web.Mvc.Test/Test/MaxLengthAttributeAdapterTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

44
using System.ComponentModel.DataAnnotations;
5-
using System.Linq;
65
using Microsoft.TestCommon;
76

87
namespace System.Web.Mvc.Test
98
{
9+
[Xunit.Collection("Uses ScopeStorage or ViewEngines.Engines")] // Uses ModelMetadataProviders.Current
1010
public class MaxLengthAttributeAdapterTest
1111
{
1212
[Fact]

test/System.Web.Mvc.Test/Test/MinLengthAttributeAdapterTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

44
using System.ComponentModel.DataAnnotations;
5-
using System.Linq;
65
using Microsoft.TestCommon;
76

87
namespace System.Web.Mvc.Test
98
{
9+
[Xunit.Collection("Uses ScopeStorage or ViewEngines.Engines")] // Uses ModelMetadataProviders.Current
1010
public class MinLengthAttributeAdapterTest
1111
{
1212
[Fact]

0 commit comments

Comments
 (0)