提交 d1c0f94b 编写于 作者: J Jason Malinowski

Add a test for AnalyzerConfigDocument synchronization at the OOP layer

上级 b894bb95
......@@ -2,6 +2,7 @@
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
......@@ -282,6 +283,37 @@ public async Task TestAdditionalDocument()
}
}
[Fact, Trait(Traits.Feature, Traits.Features.RemoteHost)]
public async Task TestAnalyzerConfigDocument()
{
var code = @"class Test { void Method() { } }";
using (var workspace = TestWorkspace.CreateCSharp(code))
{
var projectId = workspace.CurrentSolution.ProjectIds.First();
var analyzerConfigDocumentId = DocumentId.CreateNewId(projectId);
var analyzerConfigDocumentInfo = DocumentInfo.Create(
analyzerConfigDocumentId, ".editorconfig",
loader: TextLoader.From(TextAndVersion.Create(SourceText.From("root = true"), VersionStamp.Create())));
await VerifySolutionUpdate(workspace, s =>
{
return s.AddAnalyzerConfigDocuments(ImmutableArray.Create(analyzerConfigDocumentInfo));
});
workspace.OnAnalyzerConfigDocumentAdded(analyzerConfigDocumentInfo);
await VerifySolutionUpdate(workspace, s =>
{
return s.WithAnalyzerConfigDocumentText(analyzerConfigDocumentId, SourceText.From("root = false"));
});
await VerifySolutionUpdate(workspace, s =>
{
return s.RemoveAnalyzerConfigDocument(analyzerConfigDocumentId);
});
}
}
[Fact, Trait(Traits.Feature, Traits.Features.RemoteHost)]
public async Task TestDocument()
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册