コード例 #1
0
        private async Task VerifyImplementType(string code, string expectedChange, Dictionary <string, string> hostProperties)
        {
            var testFile = new TestFile("test.cs", code);

            using (var host = CreateOmniSharpHost(new[] { testFile }, hostProperties.ToConfiguration()))
            {
                var requestHandler = host.GetRequestHandler <RunCodeActionService>(OmniSharpEndpoints.V2.RunCodeAction);
                var point          = testFile.Content.GetPointFromPosition();

                var request = new RunCodeActionRequest
                {
                    Line                         = point.Line,
                    Column                       = point.Offset,
                    FileName                     = testFile.FileName,
                    Buffer                       = testFile.Content.Code,
                    Identifier                   = "False;False;True:global::IFoo;AssemblyName;Microsoft.CodeAnalysis.ImplementInterface.AbstractImplementInterfaceService+ImplementInterfaceCodeAction;",
                    WantsTextChanges             = true,
                    WantsAllCodeActionOperations = true
                };

                var response = await requestHandler.Handle(request);

                var changes = response.Changes.ToArray();

                Assert.Single(changes);
                Assert.NotNull(changes[0].FileName);
                AssertUtils.AssertIgnoringIndentAndNewlines(expectedChange, ((ModifiedFileResponse)changes[0]).Changes.First().NewText);
            }
        }