Skip to content

Commit

Permalink
fixed test
Browse files Browse the repository at this point in the history
  • Loading branch information
filipw committed Jun 5, 2019
1 parent 97f0b4e commit 5a6e450
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
9 changes: 3 additions & 6 deletions tests/OmniSharp.Roslyn.CSharp.Tests/BufferManagerFacts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
4 changes: 2 additions & 2 deletions tests/OmniSharp.Tests/UpdateBufferFilterFacts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
Expand Down

0 comments on commit 5a6e450

Please # to comment.