Пример #1
0
        private async Task <RunCodeActionResponse> RunRefactoringsAsync(string source, string identifier, bool wantsChanges = false)
        {
            var loggerFactory = new FakeLoggerFactory();
            var request       = CreateRunCodeActionRequest(source, identifier, wantsChanges);

            _host      = _host ?? TestHelpers.CreatePluginHost(new[] { typeof(RoslynCodeActionProvider).GetTypeInfo().Assembly, typeof(NRefactoryCodeActionProvider).GetTypeInfo().Assembly, typeof(GetCodeActionsService).GetTypeInfo().Assembly });
            _workspace = _workspace ?? await TestHelpers.CreateSimpleWorkspace(_host, request.Buffer, bufferPath);

            var controller = new RunCodeActionService(
                _workspace,
                CreateCodeActionProviders(),
                loggerFactory);
            var response = await controller.Handle(request);

            return(response);
        }
Пример #2
0
        private async Task <IEnumerable <OmniSharpCodeAction> > FindRefactoringsAsync(string source)
        {
            var loggerFactory = new FakeLoggerFactory();
            var request       = CreateGetCodeActionsRequest(source);

            _host      = _host ?? TestHelpers.CreatePluginHost(new[] { typeof(RoslynCodeActionProvider).GetTypeInfo().Assembly, typeof(NRefactoryCodeActionProvider).GetTypeInfo().Assembly, typeof(GetCodeActionsService).GetTypeInfo().Assembly });
            _workspace = _workspace ?? await TestHelpers.CreateSimpleWorkspace(_host, request.Buffer, bufferPath);

            var controller = new GetCodeActionsService(
                _workspace,
                CreateCodeActionProviders(),
                loggerFactory);
            var response = await controller.Handle(request);

            return(response.CodeActions);
        }
 private async Task<RunCodeActionResponse> RunRefactoringsAsync(string source, string identifier, bool wantsChanges = false)
 {
     var loggerFactory = new FakeLoggerFactory();
     var request = CreateRunCodeActionRequest(source, identifier, wantsChanges);
     _host = _host ?? TestHelpers.CreatePluginHost(new[] { typeof(RoslynCodeActionProvider).GetTypeInfo().Assembly, typeof(NRefactoryCodeActionProvider).GetTypeInfo().Assembly, typeof(GetCodeActionsService).GetTypeInfo().Assembly });
     _workspace = _workspace ?? await TestHelpers.CreateSimpleWorkspace(_host, request.Buffer, bufferPath);
     var controller = new RunCodeActionService(
         _workspace,
         CreateCodeActionProviders(),
         loggerFactory);
     var response = await controller.Handle(request);
     return response;
 }
 private async Task<IEnumerable<OmniSharpCodeAction>> FindRefactoringsAsync(string source)
 {
     var loggerFactory = new FakeLoggerFactory();
     var request = CreateGetCodeActionsRequest(source);
     _host = _host ?? TestHelpers.CreatePluginHost(new[] { typeof(RoslynCodeActionProvider).GetTypeInfo().Assembly, typeof(NRefactoryCodeActionProvider).GetTypeInfo().Assembly, typeof(GetCodeActionsService).GetTypeInfo().Assembly });
     _workspace = _workspace ?? await TestHelpers.CreateSimpleWorkspace(_host, request.Buffer, bufferPath);
     var controller = new GetCodeActionsService(
         _workspace,
         CreateCodeActionProviders(),
         loggerFactory);
     var response = await controller.Handle(request);
     return response.CodeActions;
 }