diff --git a/Directory.Build.props b/Directory.Build.props index 226196172..4240110bf 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -50,7 +50,7 @@ - + - - + + diff --git a/tests/.editorconfig b/tests/.editorconfig index 48602a574..1e6052f0b 100644 --- a/tests/.editorconfig +++ b/tests/.editorconfig @@ -45,3 +45,4 @@ dotnet_diagnostic.CA1849.severity = suggestion # CA1849: Call async methods whe dotnet_diagnostic.xUnit1026.severity = none # xUnit1026: Theory methods should use all of their parameters dotnet_diagnostic.S1144.severity = suggestion # S1144: Unused private types or members should be removed dotnet_diagnostic.S2094.severity = suggestion # S2094: Classes should not be empty +dotnet_diagnostic.S6562.severity = suggestion # "Provide the "DateTimeKind" when creating this object. diff --git a/tests/Directory.Build.props b/tests/Directory.Build.props index 88bf027c6..9c7deed55 100644 --- a/tests/Directory.Build.props +++ b/tests/Directory.Build.props @@ -20,26 +20,16 @@ - + - - - - + all runtime; build; native; contentfiles; analyzers NU1701 - - - all - runtime; build; native; contentfiles; analyzers - - - diff --git a/tests/bunit.testassets/AssertExtensions/CollectionAssertExtensions.cs b/tests/bunit.testassets/AssertExtensions/CollectionAssertExtensions.cs index c647bbae6..c0b8da403 100644 --- a/tests/bunit.testassets/AssertExtensions/CollectionAssertExtensions.cs +++ b/tests/bunit.testassets/AssertExtensions/CollectionAssertExtensions.cs @@ -18,32 +18,4 @@ public static void ShouldAllBe(this IEnumerable collection, params Action< { Assert.Collection(collection, elementInspectors); } - - /// - /// Verifies that a collection contains exactly a given number of elements, which - /// meet the criteria provided by the element inspectors. - /// - /// The collection to be inspected. - /// The element inspectors, which inspect each element and its index in the collection in turn. The total number of element inspectors must exactly match the number of elements in the collection. - public static void ShouldAllBe(this IEnumerable collection, params Action[] elementInspectors) - { - T[] elements = collection.ToArray(); - int expectedCount = elementInspectors.Length; - int actualCount = elements.Length; - - if (expectedCount != actualCount) - throw new CollectionException(collection, expectedCount, actualCount); - - for (int idx = 0; idx < actualCount; idx++) - { - try - { - elementInspectors[idx](elements[idx], idx); - } - catch (Exception ex) - { - throw new CollectionException(collection, expectedCount, actualCount, idx, ex); - } - } - } } diff --git a/tests/bunit.web.testcomponents.tests/bunit.web.testcomponents.tests.csproj b/tests/bunit.web.testcomponents.tests/bunit.web.testcomponents.tests.csproj index c858225e1..6bbbe3330 100644 --- a/tests/bunit.web.testcomponents.tests/bunit.web.testcomponents.tests.csproj +++ b/tests/bunit.web.testcomponents.tests/bunit.web.testcomponents.tests.csproj @@ -8,13 +8,14 @@ - - - - + + + + NU1605 - + + diff --git a/tests/bunit.web.tests/BlazorE2E/ComponentRenderingTest.cs b/tests/bunit.web.tests/BlazorE2E/ComponentRenderingTest.cs index 82a953d93..926523bc9 100644 --- a/tests/bunit.web.tests/BlazorE2E/ComponentRenderingTest.cs +++ b/tests/bunit.web.tests/BlazorE2E/ComponentRenderingTest.cs @@ -644,7 +644,7 @@ public void CanPatchRenderTreeToMatchLatestDOMState() // because the diff algorithm explicitly unchecks it cut.Find(".incomplete-items .item-isdone").Change(true); var incompleteLIs = cut.FindAll(incompleteItemsSelector); - Assert.Equal(1, incompleteLIs.Count); + Assert.Single(incompleteLIs); Assert.False(incompleteLIs[0].QuerySelector(".item-isdone").HasAttribute("checked")); // Mark first done item as not done; observe the remaining complete item appears checked diff --git a/tests/bunit.web.tests/TestDoubles/Authorization/FakeAuthorizationPolicyProviderTest.cs b/tests/bunit.web.tests/TestDoubles/Authorization/FakeAuthorizationPolicyProviderTest.cs index be87d41c2..08c0ec4d6 100644 --- a/tests/bunit.web.tests/TestDoubles/Authorization/FakeAuthorizationPolicyProviderTest.cs +++ b/tests/bunit.web.tests/TestDoubles/Authorization/FakeAuthorizationPolicyProviderTest.cs @@ -15,8 +15,8 @@ public async Task Test001() // assert Assert.NotNull(policy); - Assert.Equal(0, policy.AuthenticationSchemes.Count); - Assert.Equal(1, policy.Requirements.Count); + Assert.Empty(policy.AuthenticationSchemes); + Assert.Single(policy.Requirements); Assert.IsType(policy.Requirements[0]); }