Пример #1
0
        private async Task <FixUsingsResponse> RunFixUsings(string fileContents)
        {
            var host      = TestHelpers.CreatePluginHost(new[] { typeof(FixUsingService).GetTypeInfo().Assembly });
            var workspace = await TestHelpers.CreateSimpleWorkspace(host, fileContents, fileName);

            var fakeOptions = new FakeOmniSharpOptions();

            fakeOptions.Options = new OmniSharpOptions(new FormattingOptions()
            {
                NewLine = "\n"
            });
            var providers  = host.GetExports <ICodeActionProvider>();
            var controller = new FixUsingService(workspace, new FakeLoggerFactory(), _loader, providers);
            var request    = new FixUsingsRequest
            {
                FileName = fileName,
                Buffer   = fileContents
            };

            return(await controller.Handle(request));
        }
Пример #2
0
        private async Task<FixUsingsResponse> RunFixUsings(string fileContents)
        {
            var workspace = TestHelpers.CreateSimpleWorkspace(fileContents, fileName);

            var fakeOptions = new FakeOmniSharpOptions();
            fakeOptions.Options = new OmniSharpOptions();
            fakeOptions.Options.FormattingOptions = new FormattingOptions() {NewLine = "\n"};
            var controller = new OmnisharpController(workspace, fakeOptions);
            var request = new FixUsingsRequest
            {
                FileName = fileName,
                Buffer = fileContents
            };
            return await controller.FixUsings(request);
        }
Пример #3
0
        private async Task<FixUsingsResponse> RunFixUsings(string fileContents)
        {
            var host = TestHelpers.CreatePluginHost(new[] { typeof(FixUsingService).GetTypeInfo().Assembly });
            var workspace = await TestHelpers.CreateSimpleWorkspace(host, fileContents, fileName);

            var fakeOptions = new FakeOmniSharpOptions();
            fakeOptions.Options = new OmniSharpOptions();
            fakeOptions.Options.FormattingOptions = new FormattingOptions() { NewLine = "\n" };
            var providers = host.GetExports<ICodeActionProvider>();
            var controller = new FixUsingService(workspace, providers);
            var request = new FixUsingsRequest
            {
                FileName = fileName,
                Buffer = fileContents
            };
            return await controller.Handle(request);
        }