From af41d67c059056fa445e25c17f6a4bb3f133dcae Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 22 Jan 2025 09:19:30 -0800 Subject: [PATCH] Use Assert.Empty --- .../Test/Collections/Immutable/Maps/MapTests.cs | 4 ++-- .../Test/Extensions/CollectionExtensionsTest.cs | 6 +++--- .../AbstractMetadataAsSourceTests.TestContext.cs | 4 ++-- .../Test2/CodeFixes/CodeFixServiceTests.vb | 8 ++++---- .../Test2/Diagnostics/DiagnosticProviderTests.vb | 2 +- .../Test2/Diagnostics/DiagnosticServiceTests.vb | 14 +++++++------- .../TestUtilities/Rename/RenamerTests.cs | 2 +- .../Recommendations/RecommendationTestHelpers.vb | 2 +- .../Test/ExpressionCompiler/LocalFunctionTests.cs | 4 ++-- .../CSharp/Test/ExpressionCompiler/LocalsTests.cs | 12 ++++++------ .../Test/ExpressionCompiler/UsingDebugInfoTests.cs | 4 ++-- .../Test/ExpressionCompiler/LocalsTests.vb | 10 +++++----- .../Diagnostics/PullDiagnosticTests.cs | 6 +++--- .../RelatedDocuments/RelatedDocumentsTests.cs | 2 +- .../CoreTest.Desktop/GlobalAssemblyCacheTests.cs | 8 ++++---- .../Test/DocumentOutline/DocumentOutlineTests.cs | 2 +- .../CodeGeneration/SyntaxGeneratorTests.cs | 6 +++--- .../CodeGeneration/SyntaxGeneratorTests.vb | 6 +++--- 18 files changed, 51 insertions(+), 51 deletions(-) diff --git a/src/EditorFeatures/Test/Collections/Immutable/Maps/MapTests.cs b/src/EditorFeatures/Test/Collections/Immutable/Maps/MapTests.cs index 94f2d5822f574..11a1d52fdbfd1 100644 --- a/src/EditorFeatures/Test/Collections/Immutable/Maps/MapTests.cs +++ b/src/EditorFeatures/Test/Collections/Immutable/Maps/MapTests.cs @@ -76,7 +76,7 @@ public void TestRemove() Assert.Equal(1, map.Count); map = map.Remove("5"); - Assert.Equal(0, map.Count); + Assert.Empty(map); } [Fact] @@ -116,7 +116,7 @@ public void TestPathology() Assert.Equal(1, map.Count); map = map.Remove("5"); - Assert.Equal(0, map.Count); + Assert.Empty(map); } private class PathologicalComparer : IEqualityComparer diff --git a/src/EditorFeatures/Test/Extensions/CollectionExtensionsTest.cs b/src/EditorFeatures/Test/Extensions/CollectionExtensionsTest.cs index cc184d27aaac6..6a4dfe5942975 100644 --- a/src/EditorFeatures/Test/Extensions/CollectionExtensionsTest.cs +++ b/src/EditorFeatures/Test/Extensions/CollectionExtensionsTest.cs @@ -21,7 +21,7 @@ public void PushReverse1() Assert.Equal(1, stack.Pop()); Assert.Equal(2, stack.Pop()); Assert.Equal(3, stack.Pop()); - Assert.Equal(0, stack.Count); + Assert.Empty(stack); } [Fact] @@ -29,7 +29,7 @@ public void PushReverse2() { var stack = new Stack(); stack.PushReverse(Array.Empty()); - Assert.Equal(0, stack.Count); + Assert.Empty(stack); } [Fact] @@ -41,6 +41,6 @@ public void PushReverse3() Assert.Equal(1, stack.Pop()); Assert.Equal(2, stack.Pop()); Assert.Equal(3, stack.Pop()); - Assert.Equal(0, stack.Count); + Assert.Empty(stack); } } diff --git a/src/EditorFeatures/Test/MetadataAsSource/AbstractMetadataAsSourceTests.TestContext.cs b/src/EditorFeatures/Test/MetadataAsSource/AbstractMetadataAsSourceTests.TestContext.cs index d0686f539086b..8e00e418bd095 100644 --- a/src/EditorFeatures/Test/MetadataAsSource/AbstractMetadataAsSourceTests.TestContext.cs +++ b/src/EditorFeatures/Test/MetadataAsSource/AbstractMetadataAsSourceTests.TestContext.cs @@ -104,7 +104,7 @@ public async Task GenerateSourceAsync( // Get an ISymbol corresponding to the metadata name var compilation = await project.GetRequiredCompilationAsync(CancellationToken.None); var diagnostics = compilation.GetDiagnostics().ToArray(); - Assert.Equal(0, diagnostics.Length); + Assert.Empty(diagnostics); var symbol = await ResolveSymbolAsync(symbolMetadataName, compilation); Contract.ThrowIfNull(symbol); @@ -172,7 +172,7 @@ public void Dispose() { compilation = await this.DefaultProject.GetRequiredCompilationAsync(CancellationToken.None); var diagnostics = compilation.GetDiagnostics().ToArray(); - Assert.Equal(0, diagnostics.Length); + Assert.Empty(diagnostics); } foreach (var reference in compilation.References) diff --git a/src/EditorFeatures/Test2/CodeFixes/CodeFixServiceTests.vb b/src/EditorFeatures/Test2/CodeFixes/CodeFixServiceTests.vb index 5b996eecaa62c..daa4127eee1c4 100644 --- a/src/EditorFeatures/Test2/CodeFixes/CodeFixServiceTests.vb +++ b/src/EditorFeatures/Test2/CodeFixes/CodeFixServiceTests.vb @@ -78,7 +78,7 @@ Namespace Microsoft.CodeAnalysis.Editor.Implementation.CodeFixes.UnitTests (Await document.GetSyntaxRootAsync()).FullSpan, CancellationToken.None) - Assert.Equal(0, fixes.Length) + Assert.Empty(fixes) ' Verify available codefix with a global fixer + a project fixer ' We will use this assembly as a project fixer provider. @@ -102,7 +102,7 @@ Namespace Microsoft.CodeAnalysis.Editor.Implementation.CodeFixes.UnitTests (Await document.GetSyntaxRootAsync()).FullSpan, CancellationToken.None) - Assert.Equal(0, fixes.Length) + Assert.Empty(fixes) End Using End Function @@ -150,7 +150,7 @@ Namespace Microsoft.CodeAnalysis.Editor.Implementation.CodeFixes.UnitTests (Await document.GetSyntaxRootAsync()).FullSpan, CancellationToken.None) - Assert.Equal(0, fixes.Length) + Assert.Empty(fixes) ' Verify no codefix with a global fixer + a project fixer ' We will use this assembly as a project fixer provider. @@ -165,7 +165,7 @@ Namespace Microsoft.CodeAnalysis.Editor.Implementation.CodeFixes.UnitTests (Await document.GetSyntaxRootAsync()).FullSpan, CancellationToken.None) - Assert.Equal(0, fixes.Length) + Assert.Empty(fixes) End Using End Function diff --git a/src/EditorFeatures/Test2/Diagnostics/DiagnosticProviderTests.vb b/src/EditorFeatures/Test2/Diagnostics/DiagnosticProviderTests.vb index 088b930be272f..529c101cda77e 100644 --- a/src/EditorFeatures/Test2/Diagnostics/DiagnosticProviderTests.vb +++ b/src/EditorFeatures/Test2/Diagnostics/DiagnosticProviderTests.vb @@ -266,7 +266,7 @@ Namespace Microsoft.CodeAnalysis.Editor.Implementation.Diagnostics.UnitTests includeSuppressedDiagnostics:=False, includeLocalDocumentDiagnostics:=True, includeNonLocalDocumentDiagnostics:=True, CancellationToken.None).Result If diagnostics Is Nothing Then - Assert.Equal(0, actualDiagnostics.Length) + Assert.Empty(actualDiagnostics) Else Dim expectedDiagnostics = GetExpectedDiagnostics(workspace, diagnostics) diff --git a/src/EditorFeatures/Test2/Diagnostics/DiagnosticServiceTests.vb b/src/EditorFeatures/Test2/Diagnostics/DiagnosticServiceTests.vb index 3a9f4c2a0ec60..fe9d71920dda3 100644 --- a/src/EditorFeatures/Test2/Diagnostics/DiagnosticServiceTests.vb +++ b/src/EditorFeatures/Test2/Diagnostics/DiagnosticServiceTests.vb @@ -300,7 +300,7 @@ Namespace Microsoft.CodeAnalysis.Editor.Implementation.Diagnostics.UnitTests project = project.WithCompilationOptions(newCompilationOptions) document = project.Documents.Single() diagnostics = Await GetDiagnosticsForSpanAsync(diagnosticService, document, span) - Assert.Equal(0, diagnostics.Length) + Assert.Empty(diagnostics) Dim changeSeverityDiagOptions = New Dictionary(Of String, ReportDiagnostic) changeSeverityDiagOptions.Add(workspaceDiagnosticAnalyzer.DiagDescriptor.Id, ReportDiagnostic.Error) @@ -350,7 +350,7 @@ Namespace Microsoft.CodeAnalysis.Editor.Implementation.Diagnostics.UnitTests Dim hostAnalyzers = solution.SolutionState.Analyzers Dim workspaceDescriptors = hostAnalyzers.GetDiagnosticDescriptorsPerReference(diagnosticService.AnalyzerInfoCache) - Assert.Equal(0, workspaceDescriptors.Count) + Assert.Empty(workspaceDescriptors) Dim descriptors1 = hostAnalyzers.GetDiagnosticDescriptorsPerReference(diagnosticService.AnalyzerInfoCache, p1) Assert.Equal("XX0001", descriptors1.Single().Value.Single().Id) @@ -494,14 +494,14 @@ Namespace Microsoft.CodeAnalysis.Editor.Implementation.Diagnostics.UnitTests Dim descriptorsMap = solution.SolutionState.Analyzers.GetDiagnosticDescriptorsPerReference(diagnosticService.AnalyzerInfoCache, project) Assert.Equal(1, descriptorsMap.Count) Dim descriptors = descriptorsMap.First().Value - Assert.Equal(0, descriptors.Length) + Assert.Empty(descriptors) Dim document = project.Documents.Single() Dim incrementalAnalyzer = diagnosticService.CreateIncrementalAnalyzer(workspace) Dim diagnostics = Await GetDiagnosticsForDocumentAsync(diagnosticService, document) - Assert.Equal(0, diagnostics.Length) + Assert.Empty(diagnostics) End Using End Function @@ -534,7 +534,7 @@ Namespace Microsoft.CodeAnalysis.Editor.Implementation.Diagnostics.UnitTests Dim incrementalAnalyzer = diagnosticService.CreateIncrementalAnalyzer(workspace) Dim root = Await document.GetSyntaxRootAsync().ConfigureAwait(False) Dim diagnostics = Await GetDiagnosticsForSpanAsync(diagnosticService, document, root.FullSpan) - Assert.Equal(0, diagnostics.Length) + Assert.Empty(diagnostics) diagnostics = Await diagnosticService.GetDiagnosticsForIdsAsync( project.Solution, projectId:=Nothing, documentId:=Nothing, diagnosticIds:=Nothing, shouldIncludeAnalyzer:=Nothing, @@ -2096,7 +2096,7 @@ class MyClass Dim document = project.Documents.Single() Dim diagnostics = Await GetDiagnosticsForDocumentAsync(diagnosticService, document) - Assert.Equal(0, diagnostics.Length) + Assert.Empty(diagnostics) End Using End Function @@ -2237,7 +2237,7 @@ class C Dim diagnostics = Await diagnosticService.GetDiagnosticsForIdsAsync( project.Solution, project.Id, documentId:=Nothing, diagnosticIds:=Nothing, shouldIncludeAnalyzer:=Nothing, includeSuppressedDiagnostics:=False, includeLocalDocumentDiagnostics:=True, includeNonLocalDocumentDiagnostics:=True, CancellationToken.None) - Assert.Equal(0, diagnostics.Length) + Assert.Empty(diagnostics) End Using End Function diff --git a/src/EditorFeatures/TestUtilities/Rename/RenamerTests.cs b/src/EditorFeatures/TestUtilities/Rename/RenamerTests.cs index 3b70d661c01e3..d628c3bfc5e96 100644 --- a/src/EditorFeatures/TestUtilities/Rename/RenamerTests.cs +++ b/src/EditorFeatures/TestUtilities/Rename/RenamerTests.cs @@ -99,7 +99,7 @@ protected async Task TestRenameDocument( } AssertEx.EqualOrDiff(endDocument.Text, (await updatedDocument.GetTextAsync()).ToString()); - Assert.Equal(0, remainingErrors.Count); + Assert.Empty(remainingErrors); } } diff --git a/src/EditorFeatures/VisualBasicTest/Recommendations/RecommendationTestHelpers.vb b/src/EditorFeatures/VisualBasicTest/Recommendations/RecommendationTestHelpers.vb index 15f02976ee58c..d9e46a4ee0d3a 100644 --- a/src/EditorFeatures/VisualBasicTest/Recommendations/RecommendationTestHelpers.vb +++ b/src/EditorFeatures/VisualBasicTest/Recommendations/RecommendationTestHelpers.vb @@ -147,7 +147,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Recommendations .OrderBy(Function(recommendation) recommendation) _ .ToArray() - Assert.Equal(0, recommendedKeywords.Length) + Assert.Empty(recommendedKeywords) End Sub Private Function GetSourceCodeKind(testSource As XElement) As SourceCodeKind diff --git a/src/ExpressionEvaluator/CSharp/Test/ExpressionCompiler/LocalFunctionTests.cs b/src/ExpressionEvaluator/CSharp/Test/ExpressionCompiler/LocalFunctionTests.cs index e81aed85b3051..6e768a7bc4c8e 100644 --- a/src/ExpressionEvaluator/CSharp/Test/ExpressionCompiler/LocalFunctionTests.cs +++ b/src/ExpressionEvaluator/CSharp/Test/ExpressionCompiler/LocalFunctionTests.cs @@ -41,8 +41,8 @@ int G() string typeName; var assembly = context.CompileGetLocals(locals, argumentsOnly: false, typeName: out typeName, testData: testData); Assert.NotNull(assembly); - Assert.Equal(0, assembly.Count); - Assert.Equal(0, locals.Count); + Assert.Empty(assembly); + Assert.Empty(locals); locals.Free(); }); } diff --git a/src/ExpressionEvaluator/CSharp/Test/ExpressionCompiler/LocalsTests.cs b/src/ExpressionEvaluator/CSharp/Test/ExpressionCompiler/LocalsTests.cs index 288b380a00f08..27c357e83e38b 100644 --- a/src/ExpressionEvaluator/CSharp/Test/ExpressionCompiler/LocalsTests.cs +++ b/src/ExpressionEvaluator/CSharp/Test/ExpressionCompiler/LocalsTests.cs @@ -46,8 +46,8 @@ static void M() string typeName; var assembly = context.CompileGetLocals(locals, argumentsOnly: false, typeName: out typeName, testData: testData); Assert.NotNull(assembly); - Assert.Equal(0, assembly.Count); - Assert.Equal(0, locals.Count); + Assert.Empty(assembly); + Assert.Empty(locals); locals.Free(); }); } @@ -2491,7 +2491,7 @@ static void M(A a, B b, C c) Diagnostic(ErrorCode.ERR_NoTypeDef).WithArguments("A", "Comp1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(1, 1) ]); - Assert.Equal(0, locals.Count); + Assert.Empty(locals); locals.Free(); }); } @@ -2535,7 +2535,7 @@ static void M(object o) where T : I Diagnostic(ErrorCode.ERR_NoTypeDef).WithArguments("I", "Comp1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(1, 1) ]); - Assert.Equal(0, locals.Count); + Assert.Empty(locals); locals.Free(); }); } @@ -5116,7 +5116,7 @@ private static void GetLocals(RuntimeInstance runtime, string methodName, bool a Assert.NotNull(assembly); if (count == 0) { - Assert.Equal(0, assembly.Count); + Assert.Empty(assembly); } else { @@ -5156,7 +5156,7 @@ private static void GetLocals(RuntimeInstance runtime, string methodName, Method Assert.NotNull(assembly); if (count == 0) { - Assert.Equal(0, assembly.Count); + Assert.Empty(assembly); } else { diff --git a/src/ExpressionEvaluator/CSharp/Test/ExpressionCompiler/UsingDebugInfoTests.cs b/src/ExpressionEvaluator/CSharp/Test/ExpressionCompiler/UsingDebugInfoTests.cs index 27a7d762f5b1c..1bdf2288df498 100644 --- a/src/ExpressionEvaluator/CSharp/Test/ExpressionCompiler/UsingDebugInfoTests.cs +++ b/src/ExpressionEvaluator/CSharp/Test/ExpressionCompiler/UsingDebugInfoTests.cs @@ -405,11 +405,11 @@ public void BadPdb_ForwardChain() importStrings = CustomDebugInfoReader.GetCSharpGroupedImportStrings(methodToken2, 0, getMethodCustomDebugInfo, getMethodImportStrings, out externAliasStrings); Assert.Equal(importString, importStrings.Single().Single()); - Assert.Equal(0, externAliasStrings.Length); + Assert.Empty(externAliasStrings); importStrings = CustomDebugInfoReader.GetCSharpGroupedImportStrings(methodToken2, 0, getMethodCustomDebugInfo, getMethodImportStrings, out externAliasStrings); Assert.Equal(importString, importStrings.Single().Single()); - Assert.Equal(0, externAliasStrings.Length); + Assert.Empty(externAliasStrings); } [Fact] diff --git a/src/ExpressionEvaluator/VisualBasic/Test/ExpressionCompiler/LocalsTests.vb b/src/ExpressionEvaluator/VisualBasic/Test/ExpressionCompiler/LocalsTests.vb index 06b0ccd3d7737..b3bbf6b46a89f 100644 --- a/src/ExpressionEvaluator/VisualBasic/Test/ExpressionCompiler/LocalsTests.vb +++ b/src/ExpressionEvaluator/VisualBasic/Test/ExpressionCompiler/LocalsTests.vb @@ -36,8 +36,8 @@ End Class" Dim typeName As String = Nothing Dim assembly = context.CompileGetLocals(locals, argumentsOnly:=False, typeName:=typeName, testData:=testData) Assert.NotNull(assembly) - Assert.Equal(0, assembly.Count) - Assert.Equal(0, locals.Count) + Assert.Empty(assembly) + Assert.Empty(locals) locals.Free() End Sub) End Sub @@ -1789,7 +1789,7 @@ End Class" Diagnostic(ERRID.ERR_TypeRefResolutionError3, "a").WithArguments("A", "Test.dll").WithLocation(1, 1) }) - Assert.Equal(0, locals.Count) + Assert.Empty(locals) locals.Free() End Sub) End Sub @@ -3373,7 +3373,7 @@ End Class" Assert.NotNull(assembly) If count = 0 Then - Assert.Equal(0, assembly.Count) + Assert.Empty(assembly) Else Assert.InRange(assembly.Count, 0, Integer.MaxValue) End If @@ -3408,7 +3408,7 @@ End Class" Assert.NotNull(assembly) If count = 0 Then - Assert.Equal(0, assembly.Count) + Assert.Empty(assembly) Else Assert.InRange(assembly.Count, 0, Integer.MaxValue) End If diff --git a/src/LanguageServer/ProtocolUnitTests/Diagnostics/PullDiagnosticTests.cs b/src/LanguageServer/ProtocolUnitTests/Diagnostics/PullDiagnosticTests.cs index 8e5958674d2b3..a840823f2adc5 100644 --- a/src/LanguageServer/ProtocolUnitTests/Diagnostics/PullDiagnosticTests.cs +++ b/src/LanguageServer/ProtocolUnitTests/Diagnostics/PullDiagnosticTests.cs @@ -1049,7 +1049,7 @@ class A { var results = await RunGetWorkspacePullDiagnosticsAsync(testLspServer, useVSDiagnostics: true, includeTaskListItems: false, category: PullDiagnosticCategories.Task); - Assert.Equal(0, results.Length); + Assert.Empty(results); } [Theory, CombinatorialData] @@ -1115,7 +1115,7 @@ class A { var results = await RunGetWorkspacePullDiagnosticsAsync(testLspServer, useVSDiagnostics: true, includeTaskListItems: false, category: PullDiagnosticCategories.Task); - Assert.Equal(0, results.Length); + Assert.Empty(results); } [Theory, CombinatorialData] @@ -2115,7 +2115,7 @@ public async Task TestWorkspaceDiagnosticsForClosedFilesSwitchFSAFromOffToOn(boo var results = await RunGetWorkspacePullDiagnosticsAsync(testLspServer, useVSDiagnostics); - Assert.Equal(0, results.Length); + Assert.Empty(results); var options = testLspServer.TestWorkspace.ExportProvider.GetExportedValue(); options.SetGlobalOption(SolutionCrawlerOptionsStorage.BackgroundAnalysisScopeOption, LanguageNames.CSharp, BackgroundAnalysisScope.FullSolution); diff --git a/src/LanguageServer/ProtocolUnitTests/RelatedDocuments/RelatedDocumentsTests.cs b/src/LanguageServer/ProtocolUnitTests/RelatedDocuments/RelatedDocumentsTests.cs index 6679d9089c729..979a37c00517c 100644 --- a/src/LanguageServer/ProtocolUnitTests/RelatedDocuments/RelatedDocumentsTests.cs +++ b/src/LanguageServer/ProtocolUnitTests/RelatedDocuments/RelatedDocumentsTests.cs @@ -67,7 +67,7 @@ class Y project.Documents.First().GetURI(), useProgress: useProgress); - Assert.Equal(0, results.Length); + Assert.Empty(results); } [Theory, CombinatorialData] diff --git a/src/Scripting/CoreTest.Desktop/GlobalAssemblyCacheTests.cs b/src/Scripting/CoreTest.Desktop/GlobalAssemblyCacheTests.cs index ae6fe5dc8413d..570e5f1f5d8a2 100644 --- a/src/Scripting/CoreTest.Desktop/GlobalAssemblyCacheTests.cs +++ b/src/Scripting/CoreTest.Desktop/GlobalAssemblyCacheTests.cs @@ -72,17 +72,17 @@ public void GetAssemblyIdentities() } names = gac.GetAssemblyIdentities("x\u0002").ToArray(); - Assert.Equal(0, names.Length); + Assert.Empty(names); names = gac.GetAssemblyIdentities("\0").ToArray(); - Assert.Equal(0, names.Length); + Assert.Empty(names); names = gac.GetAssemblyIdentities("xxxx\0xxxxx").ToArray(); - Assert.Equal(0, names.Length); + Assert.Empty(names); // fusion API CreateAssemblyEnum returns S_FALSE for this name names = gac.GetAssemblyIdentities("nonexistingassemblyname" + Guid.NewGuid().ToString()).ToArray(); - Assert.Equal(0, names.Length); + Assert.Empty(names); } [Fact] diff --git a/src/VisualStudio/CSharp/Test/DocumentOutline/DocumentOutlineTests.cs b/src/VisualStudio/CSharp/Test/DocumentOutline/DocumentOutlineTests.cs index 7612de9217e32..cd5a14b769f45 100644 --- a/src/VisualStudio/CSharp/Test/DocumentOutline/DocumentOutlineTests.cs +++ b/src/VisualStudio/CSharp/Test/DocumentOutline/DocumentOutlineTests.cs @@ -146,7 +146,7 @@ public async Task TestSearchDocumentSymbolData() // No search results found searchedSymbols = DocumentOutlineViewModel.SearchDocumentSymbolData(model.DocumentSymbolData, "xyz", CancellationToken.None); - Assert.Equal(0, searchedSymbols.Length); + Assert.Empty(searchedSymbols); } [WpfFact, WorkItem("https://github.com/dotnet/roslyn/issues/66012")] diff --git a/src/Workspaces/CSharpTest/CodeGeneration/SyntaxGeneratorTests.cs b/src/Workspaces/CSharpTest/CodeGeneration/SyntaxGeneratorTests.cs index 0c2cbcda08cff..717c86bb6493b 100644 --- a/src/Workspaces/CSharpTest/CodeGeneration/SyntaxGeneratorTests.cs +++ b/src/Workspaces/CSharpTest/CodeGeneration/SyntaxGeneratorTests.cs @@ -1966,7 +1966,7 @@ public void TestAddAttributesToAccessors() private void CheckAddRemoveAttribute(SyntaxNode declaration) { var initialAttributes = Generator.GetAttributes(declaration); - Assert.Equal(0, initialAttributes.Count); + Assert.Empty(initialAttributes); var withAttribute = Generator.AddAttributes(declaration, Generator.Attribute("a")); var attrsAdded = Generator.GetAttributes(withAttribute); @@ -1974,7 +1974,7 @@ private void CheckAddRemoveAttribute(SyntaxNode declaration) var withoutAttribute = Generator.RemoveNode(withAttribute, attrsAdded[0]); var attrsRemoved = Generator.GetAttributes(withoutAttribute); - Assert.Equal(0, attrsRemoved.Count); + Assert.Empty(attrsRemoved); } [Fact] @@ -3662,7 +3662,7 @@ public void TestGetBaseAndInterfaceTypes() var baseListN = Generator.GetBaseAndInterfaceTypes(classN); Assert.NotNull(baseListN); - Assert.Equal(0, baseListN.Count); + Assert.Empty(baseListN); } [Fact] diff --git a/src/Workspaces/VisualBasicTest/CodeGeneration/SyntaxGeneratorTests.vb b/src/Workspaces/VisualBasicTest/CodeGeneration/SyntaxGeneratorTests.vb index 540d27ed70c97..396e593be6062 100644 --- a/src/Workspaces/VisualBasicTest/CodeGeneration/SyntaxGeneratorTests.vb +++ b/src/Workspaces/VisualBasicTest/CodeGeneration/SyntaxGeneratorTests.vb @@ -2285,7 +2285,7 @@ End Class Private Sub CheckAddRemoveAttribute(declaration As SyntaxNode) Dim initialAttributes = Generator.GetAttributes(declaration) - Assert.Equal(0, initialAttributes.Count) + Assert.Empty(initialAttributes) Dim withAttribute = Generator.AddAttributes(declaration, Generator.Attribute("a")) Dim attrsAdded = Generator.GetAttributes(withAttribute) @@ -2293,7 +2293,7 @@ End Class Dim withoutAttribute = Generator.RemoveNode(withAttribute, attrsAdded(0)) Dim attrsRemoved = Generator.GetAttributes(withoutAttribute) - Assert.Equal(0, attrsRemoved.Count) + Assert.Empty(attrsRemoved) End Sub @@ -3226,7 +3226,7 @@ End Class").Members(0) Dim baseListN = Generator.GetBaseAndInterfaceTypes(classN) Assert.NotNull(baseListN) - Assert.Equal(0, baseListN.Count) + Assert.Empty(baseListN) End Sub