Skip to content

Commit

Permalink
Update xunit to 2.9.2 (#76196)
Browse files Browse the repository at this point in the history
  • Loading branch information
Youssef1313 authored Dec 2, 2024
1 parent 731089c commit fac15a8
Show file tree
Hide file tree
Showing 13 changed files with 20 additions and 19 deletions.
4 changes: 2 additions & 2 deletions eng/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
-->
<MicrosoftNetCoreAppRuntimePackagesVersion>8.0.10</MicrosoftNetCoreAppRuntimePackagesVersion>
<MicrosoftWindowsDesktopAppRuntimePackagesVersion>8.0.10</MicrosoftWindowsDesktopAppRuntimePackagesVersion>
<_xunitVersion>2.6.6</_xunitVersion>
<_xunitVersion>2.9.2</_xunitVersion>
<SqliteVersion>2.1.0</SqliteVersion>
</PropertyGroup>

Expand Down Expand Up @@ -262,7 +262,7 @@
<PackageVersion Include="UIAComWrapper" Version="1.1.0.14" />
<PackageVersion Include="DiffPlex" Version="1.7.2" />
<PackageVersion Include="xunit" Version="$(_xunitVersion)" />
<PackageVersion Include="xunit.analyzers" Version="1.15.0" />
<PackageVersion Include="xunit.analyzers" Version="1.17.0" />
<PackageVersion Include="xunit.assert" Version="$(_xunitVersion)" />
<PackageVersion Include="xunit.core" Version="$(_xunitVersion)" />
<PackageVersion Include="Xunit.Combinatorial" Version="1.6.24" />
Expand Down
3 changes: 2 additions & 1 deletion src/Compilers/CSharp/Test/Emit3/FirstClassSpanTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using Microsoft.CodeAnalysis.CSharp.Symbols;
Expand All @@ -28,7 +29,7 @@ public static TheoryData<LanguageVersion> LangVersions()
}

private sealed class CombinatorialLangVersions()
: CombinatorialValuesAttribute(LangVersions().Select(d => d.Single()).ToArray());
: CombinatorialValuesAttribute(((IEnumerable<object[]>)LangVersions()).Select(d => d.Single()).ToArray());

[Fact, WorkItem("https://github.com/dotnet/runtime/issues/101261")]
public void Example_StringValuesAmbiguity()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1458,7 +1458,7 @@ public void AssemblyLoading_CompilerDependencyDuplicated(AnalyzerTestKind kind)
loader.AddDependencyLocation(destFile);

var copiedAssembly = loader.LoadFromPath(destFile);
Assert.Single(AppDomain.CurrentDomain.GetAssemblies().Where(x => x.FullName == assembly.FullName));
Assert.Single(AppDomain.CurrentDomain.GetAssemblies(), x => x.FullName == assembly.FullName);
Assert.Same(copiedAssembly, assembly);
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ protected async Task TestChangeNamespaceAsync(
var modifiedOringinalRoot = await modifiedOriginalDocument.GetSyntaxRootAsync();

// One node/token will contain the warning we attached for change namespace action.
Assert.Single(modifiedOringinalRoot.DescendantNodesAndTokensAndSelf().Where(n =>
Assert.Single(modifiedOringinalRoot.DescendantNodesAndTokensAndSelf(), n =>
{
IEnumerable<SyntaxAnnotation> annotations;
if (n.IsNode)
Expand All @@ -184,7 +184,7 @@ protected async Task TestChangeNamespaceAsync(

return annotations.Any(annotation =>
WarningAnnotation.GetDescription(annotation) == FeaturesResources.Warning_colon_changing_namespace_may_produce_invalid_code_and_change_code_meaning);
}));
});

var actualText = (await modifiedOriginalDocument.GetTextAsync()).ToString();
AssertEx.EqualOrDiff(expectedSourceOriginal, actualText);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -586,11 +586,11 @@ public class Goo
""", async w =>
{
// Do one set of queries
Assert.Single((await _aggregator.GetItemsAsync("Goo")).Where(x => x.Kind != "Method"));
Assert.Single((await _aggregator.GetItemsAsync("Goo")), x => x.Kind != "Method");
_provider.StopSearch();

// Do the same query again, make sure nothing was left over
Assert.Single((await _aggregator.GetItemsAsync("Goo")).Where(x => x.Kind != "Method"));
Assert.Single((await _aggregator.GetItemsAsync("Goo")), x => x.Kind != "Method");
_provider.StopSearch();

// Dispose the provider
Expand Down
4 changes: 2 additions & 2 deletions src/EditorFeatures/CSharpTest/NavigateTo/NavigateToTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -978,11 +978,11 @@ public class Goo
""", async w =>
{
// Do one set of queries
Assert.Single((await _aggregator.GetItemsAsync("Goo")).Where(x => x.Kind != "Method"));
Assert.Single((await _aggregator.GetItemsAsync("Goo")), x => x.Kind != "Method");
_provider.StopSearch();

// Do the same query again, make sure nothing was left over
Assert.Single((await _aggregator.GetItemsAsync("Goo")).Where(x => x.Kind != "Method"));
Assert.Single((await _aggregator.GetItemsAsync("Goo")), x => x.Kind != "Method");
_provider.StopSearch();

// Dispose the provider
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void Method() {

Assert.NotEmpty(completions.ItemsList);

var item = Assert.Single(completions.ItemsList.Where(item => item.ProviderName == typeof(DebugAssertTestCompletionProvider).FullName));
var item = Assert.Single(completions.ItemsList, item => item.ProviderName == typeof(DebugAssertTestCompletionProvider).FullName);
Assert.Equal(nameof(DebugAssertTestCompletionProvider), item.DisplayText);

var expectedDescriptionText = nameof(DebugAssertTestCompletionProvider);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ public async Task ImplementingTypesDoesProduceDelegates(TestHost host)

Assert.NotEmpty(delegates); // We should find delegates when looking for implementations
Assert.True(delegates.Any(i => i.Locations.Any(loc => loc.IsInMetadata)), "We should find a metadata delegate");
Assert.Single(delegates.Where(i => i.Locations.Any(loc => loc.IsInSource))); // We should find a single source delegate
Assert.Single(delegates, i => i.Locations.Any(loc => loc.IsInSource)); // We should find a single source delegate
}

[Theory, CombinatorialData]
Expand Down Expand Up @@ -611,7 +611,7 @@ enum E

Assert.NotEmpty(enums); // We should find enums when looking for implementations
Assert.True(enums.Any(i => i.Locations.Any(loc => loc.IsInMetadata)), "We should find a metadata enum");
Assert.Single(enums.Where(i => i.Locations.Any(loc => loc.IsInSource))); // We should find a single source type
Assert.Single(enums, i => i.Locations.Any(loc => loc.IsInSource)); // We should find a single source type
}

[Theory, CombinatorialData]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ void M()

var results = await RunGetCodeActionsAsync(testLspServer, CreateCodeActionParams(caretLocation));

var topLevelAction = Assert.Single(results.Where(action => action.Title == titlePath[0]));
var topLevelAction = Assert.Single(results, action => action.Title == titlePath[0]);
var introduceConstant = topLevelAction.Children.FirstOrDefault(
r => JsonSerializer.Deserialize<CodeActionResolveData>((JsonElement)r.Data!, ProtocolConversions.LspJsonSerializerOptions)!.UniqueIdentifier == titlePath[1]);

Expand Down
2 changes: 1 addition & 1 deletion src/Tools/TestDiscoveryWorker/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
await Console.Out.WriteLineAsync($"Discovering tests in {testDescriptor}...").ConfigureAwait(false);

using var xunit = new XunitFrontController(AppDomainSupport.IfAvailable, assemblyFileName, shadowCopy: false);
var configuration = ConfigReader.Load(assemblyFileName);
var configuration = ConfigReader.Load(assemblyFileName, configFileName: null);
var sink = new Sink();
xunit.Find(includeSourceInformation: false,
messageSink: sink,
Expand Down
2 changes: 1 addition & 1 deletion src/Workspaces/CoreTest/SolutionTests/SolutionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5695,7 +5695,7 @@ public async Task TestFrozenPartialSolution5()
Assert.Single(frozenCompilation2.SyntaxTrees);
Assert.True(frozenCompilation2.ContainsSyntaxTree(await frozenProject2.Documents.Single().GetSyntaxTreeAsync()));

Assert.Single(frozenCompilation2.References.Where(r => r is CompilationReference c && c.Compilation == frozenCompilation1));
Assert.Single(frozenCompilation2.References, r => r is CompilationReference c && c.Compilation == frozenCompilation1);
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ static async Task AssertCompilationContainsOneRegularAndOneGeneratedFile(Project
var regularDocumentSyntaxTree = await project.GetRequiredDocument(documentId).GetRequiredSyntaxTreeAsync(CancellationToken.None);
Assert.Contains(regularDocumentSyntaxTree, compilation.SyntaxTrees);

var generatedSyntaxTree = Assert.Single(compilation.SyntaxTrees.Where(t => t != regularDocumentSyntaxTree));
var generatedSyntaxTree = Assert.Single(compilation.SyntaxTrees, t => t != regularDocumentSyntaxTree);
Assert.IsType<SourceGeneratedDocument>(project.GetDocument(generatedSyntaxTree));

Assert.Equal(expectedGeneratedContents, generatedSyntaxTree.GetText().ToString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public async Task TestDirectUseOfMSBuildProjectLoader()
var solutionInfo = await msbuildProjectLoader.LoadSolutionInfoAsync(solutionFilePath);
var projectInfo = Assert.Single(solutionInfo.Projects);

Assert.Single(projectInfo.Documents.Where(d => d.Name == "CSharpClass.cs"));
Assert.Single(projectInfo.Documents, d => d.Name == "CSharpClass.cs");
}

[ConditionalFact(typeof(VisualStudioMSBuildInstalled))]
Expand Down Expand Up @@ -3240,7 +3240,7 @@ public async Task TestEditorConfigDiscovery()

// We should have exactly one .editorconfig corresponding to the file we had. We may also
// have other files if there is a .editorconfig floating around somewhere higher on the disk.
var analyzerConfigDocument = Assert.Single(project.AnalyzerConfigDocuments.Where(d => d.FilePath == expectedEditorConfigPath));
var analyzerConfigDocument = Assert.Single(project.AnalyzerConfigDocuments, d => d.FilePath == expectedEditorConfigPath);
Assert.Equal(".editorconfig", analyzerConfigDocument.Name);
var text = await analyzerConfigDocument.GetTextAsync();
Assert.Equal("root = true", text.ToString());
Expand Down

0 comments on commit fac15a8

Please sign in to comment.