From 5a6e450761b25aa44663255f0ff22224366a31e9 Mon Sep 17 00:00:00 2001 From: filipw Date: Wed, 5 Jun 2019 21:09:29 +0200 Subject: [PATCH] fixed test --- .../OmniSharp.Roslyn.CSharp.Tests/BufferManagerFacts.cs | 9 +++------ tests/OmniSharp.Tests/UpdateBufferFilterFacts.cs | 4 ++-- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/tests/OmniSharp.Roslyn.CSharp.Tests/BufferManagerFacts.cs b/tests/OmniSharp.Roslyn.CSharp.Tests/BufferManagerFacts.cs index 2eb53cf89f..5dfdd3b9ba 100644 --- a/tests/OmniSharp.Roslyn.CSharp.Tests/BufferManagerFacts.cs +++ b/tests/OmniSharp.Roslyn.CSharp.Tests/BufferManagerFacts.cs @@ -25,19 +25,16 @@ public async Task UpdateBufferIgnoresVoidRequests() { using (var host = CreateOmniSharpHost(new TestFile("test.cs", "class C {}"))) { - Assert.Equal(2, host.Workspace.CurrentSolution.Projects.Count()); + Assert.Single(host.Workspace.CurrentSolution.Projects); Assert.Single(host.Workspace.CurrentSolution.Projects.ElementAt(0).Documents); - Assert.Single(host.Workspace.CurrentSolution.Projects.ElementAt(1).Documents); await host.Workspace.BufferManager.UpdateBufferAsync(new Request() { }); - Assert.Equal(2, host.Workspace.CurrentSolution.Projects.Count()); + Assert.Single(host.Workspace.CurrentSolution.Projects); Assert.Single(host.Workspace.CurrentSolution.Projects.ElementAt(0).Documents); - Assert.Single(host.Workspace.CurrentSolution.Projects.ElementAt(1).Documents); await host.Workspace.BufferManager.UpdateBufferAsync(new Request() { FileName = "", Buffer = "enum E {}" }); - Assert.Equal(2, host.Workspace.CurrentSolution.Projects.Count()); + Assert.Single(host.Workspace.CurrentSolution.Projects); Assert.Single(host.Workspace.CurrentSolution.Projects.ElementAt(0).Documents); - Assert.Single(host.Workspace.CurrentSolution.Projects.ElementAt(1).Documents); } } diff --git a/tests/OmniSharp.Tests/UpdateBufferFilterFacts.cs b/tests/OmniSharp.Tests/UpdateBufferFilterFacts.cs index 66d8d6fa4d..dbe86862f4 100644 --- a/tests/OmniSharp.Tests/UpdateBufferFilterFacts.cs +++ b/tests/OmniSharp.Tests/UpdateBufferFilterFacts.cs @@ -59,7 +59,7 @@ public async Task UpdateBuffer_AddsNewDocumentsIfNeeded() { await host.Workspace.BufferManager.UpdateBufferAsync(new Request() { FileName = "test2.cs", Buffer = "interface I {}" }); - Assert.Equal(2, host.Workspace.CurrentSolution.GetDocumentIdsWithFilePath("test2.cs").Length); + Assert.Single(host.Workspace.CurrentSolution.GetDocumentIdsWithFilePath("test2.cs")); var docId = host.Workspace.CurrentSolution.GetDocumentIdsWithFilePath("test2.cs").FirstOrDefault(); Assert.NotNull(docId); var sourceText = await host.Workspace.CurrentSolution.GetDocument(docId).GetTextAsync(); @@ -82,7 +82,7 @@ public async Task UpdateBuffer_TransientDocumentsDisappearWhenProjectAddsThem() await host.Workspace.BufferManager.UpdateBufferAsync(new Request() { FileName = "transient.cs", Buffer = "interface I {}" }); var docIds = host.Workspace.CurrentSolution.GetDocumentIdsWithFilePath("transient.cs"); - Assert.Equal(2, docIds.Length); + Assert.Single(docIds); // simulate a project system adding the file for real var project1 = host.Workspace.CurrentSolution.Projects.First();