Skip to content

Commit ef86f1c

Browse files
committed
chore: upgrade xunit and SonarAnalyzer.CSharp packages
1 parent 90fd5fc commit ef86f1c

8 files changed

Lines changed: 15 additions & 51 deletions

File tree

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
<!-- Shared code analyzers used for all projects in the solution -->
5151
<ItemGroup Label="Code Analyzers">
5252
<PackageReference Include="AsyncFixer" Version="1.6.0" PrivateAssets="All" />
53-
<PackageReference Include="SonarAnalyzer.CSharp" Version="9.4.0.72892" PrivateAssets="All" />
53+
<PackageReference Include="SonarAnalyzer.CSharp" Version="9.5.0.73987" PrivateAssets="All" />
5454
</ItemGroup>
5555

5656
<ItemGroup Label="Implicit usings"

src/bunit.web.testcomponents/bunit.web.testcomponents.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
<ItemGroup>
2222
<PackageReference Include="SourceFileFinder" Version="1.1.0" />
2323
<PackageReference Include="xunit.assert" Version="2.4.2" />
24-
<PackageReference Include="xunit.extensibility.core" Version="2.4.2" />
25-
<PackageReference Include="xunit.extensibility.execution" Version="2.4.2" />
24+
<PackageReference Include="xunit.extensibility.core" Version="2.5.0" />
25+
<PackageReference Include="xunit.extensibility.execution" Version="2.5.0" />
2626
</ItemGroup>
2727

2828
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.1'">

tests/.editorconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,4 @@ dotnet_diagnostic.CA1849.severity = suggestion # CA1849: Call async methods whe
4545
dotnet_diagnostic.xUnit1026.severity = none # xUnit1026: Theory methods should use all of their parameters
4646
dotnet_diagnostic.S1144.severity = suggestion # S1144: Unused private types or members should be removed
4747
dotnet_diagnostic.S2094.severity = suggestion # S2094: Classes should not be empty
48+
dotnet_diagnostic.S6562.severity = suggestion # "Provide the "DateTimeKind" when creating this object.

tests/Directory.Build.props

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,16 @@
2020
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
2121
<PackageReference Include="Moq" Version="4.18.4" />
2222
<PackageReference Include="Shouldly" Version="4.2.1" />
23-
<PackageReference Include="xunit" Version="2.4.2" />
23+
<PackageReference Include="xunit" Version="2.5.0" />
2424
<PackageReference Include="Xunit.Combinatorial" Version="1.5.25" />
2525
<PackageReference Include="coverlet.msbuild" Version="6.0.0" PrivateAssets="All" />
26-
</ItemGroup>
27-
28-
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.1'">
29-
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
26+
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0">
3027
<PrivateAssets>all</PrivateAssets>
3128
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
3229
<NoWarn>NU1701</NoWarn>
3330
</PackageReference>
3431
</ItemGroup>
3532

36-
<ItemGroup Condition="'$(TargetFramework)' != 'netstandard2.1'">
37-
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
38-
<PrivateAssets>all</PrivateAssets>
39-
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
40-
</PackageReference>
41-
</ItemGroup>
42-
4333
<ItemGroup Label="Implicit usings" Condition="$(MSBuildProjectName) != 'bunit.testassets' AND $(MSBuildProjectName) != 'AngleSharpWrappers.Tests'">
4434
<Using Include="AutoFixture" />
4535
<Using Include="AutoFixture.Xunit2" />

tests/bunit.testassets/AssertExtensions/CollectionAssertExtensions.cs

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -18,32 +18,4 @@ public static void ShouldAllBe<T>(this IEnumerable<T> collection, params Action<
1818
{
1919
Assert.Collection(collection, elementInspectors);
2020
}
21-
22-
/// <summary>
23-
/// Verifies that a collection contains exactly a given number of elements, which
24-
/// meet the criteria provided by the element inspectors.
25-
/// </summary>
26-
/// <param name="collection">The collection to be inspected.</param>
27-
/// <param name="elementInspectors">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.</param>
28-
public static void ShouldAllBe<T>(this IEnumerable<T> collection, params Action<T, int>[] elementInspectors)
29-
{
30-
T[] elements = collection.ToArray();
31-
int expectedCount = elementInspectors.Length;
32-
int actualCount = elements.Length;
33-
34-
if (expectedCount != actualCount)
35-
throw new CollectionException(collection, expectedCount, actualCount);
36-
37-
for (int idx = 0; idx < actualCount; idx++)
38-
{
39-
try
40-
{
41-
elementInspectors[idx](elements[idx], idx);
42-
}
43-
catch (Exception ex)
44-
{
45-
throw new CollectionException(collection, expectedCount, actualCount, idx, ex);
46-
}
47-
}
48-
}
4921
}

tests/bunit.web.testcomponents.tests/bunit.web.testcomponents.tests.csproj

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<PackageReference Include="xunit.extensibility.core" Version="2.4.2" />
12-
<PackageReference Include="xunit.extensibility.execution" Version="2.4.2" />
13-
<PackageReference Include="xunit.runner.utility" Version="2.4.2" />
14-
<PackageReference Update="Shouldly" Version="4.1.0">
11+
<PackageReference Include="xunit.extensibility.core" Version="2.5.0" />
12+
<PackageReference Include="xunit.extensibility.execution" Version="2.5.0" />
13+
<PackageReference Include="xunit.runner.utility" Version="2.5.0" />
14+
<PackageReference Update="Shouldly" Version="4.2.1">
1515
<!-- some test fails with > 4.1.0 -->
1616
<NoWarn>NU1605</NoWarn>
17-
</PackageReference>
17+
</PackageReference>
18+
<PackageReference Update="SonarAnalyzer.CSharp" Version="9.5.0.73987" />
1819
</ItemGroup>
1920

2021
<ItemGroup>

tests/bunit.web.tests/BlazorE2E/ComponentRenderingTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ public void CanPatchRenderTreeToMatchLatestDOMState()
644644
// because the diff algorithm explicitly unchecks it
645645
cut.Find(".incomplete-items .item-isdone").Change(true);
646646
var incompleteLIs = cut.FindAll(incompleteItemsSelector);
647-
Assert.Equal(1, incompleteLIs.Count);
647+
Assert.Single(incompleteLIs);
648648
Assert.False(incompleteLIs[0].QuerySelector(".item-isdone").HasAttribute("checked"));
649649

650650
// Mark first done item as not done; observe the remaining complete item appears checked

tests/bunit.web.tests/TestDoubles/Authorization/FakeAuthorizationPolicyProviderTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ public async Task Test001()
1515

1616
// assert
1717
Assert.NotNull(policy);
18-
Assert.Equal(0, policy.AuthenticationSchemes.Count);
19-
Assert.Equal(1, policy.Requirements.Count);
18+
Assert.Empty(policy.AuthenticationSchemes);
19+
Assert.Single(policy.Requirements);
2020
Assert.IsType<DenyAnonymousAuthorizationRequirement>(policy.Requirements[0]);
2121
}
2222

0 commit comments

Comments
 (0)