提交 d6c5ac67 编写于 作者: H HeeJae Chang

use GetService from TestWorkspace for mef service

上级 5a3512c2
......@@ -14,8 +14,8 @@ namespace Microsoft.CodeAnalysis.Editor.CSharp.ChangeSignature
internal class CSharpChangeSignatureCommandHandler : AbstractChangeSignatureCommandHandler
{
[ImportingConstructor]
public CSharpChangeSignatureCommandHandler(IThreadingContext threadingContext) :
base(threadingContext)
public CSharpChangeSignatureCommandHandler(IThreadingContext threadingContext)
: base(threadingContext)
{
}
}
......
......@@ -296,7 +296,7 @@ class C
var textView = workspace.Documents.Single().GetTextView();
var handler = new CSharpChangeSignatureCommandHandler(exportProvider.GetExportedValue<IThreadingContext>());
var handler = new CSharpChangeSignatureCommandHandler(workspace.GetService<IThreadingContext>());
var state = handler.GetCommandState(new RemoveParametersCommandArgs(textView, textView.TextBuffer));
Assert.True(state.IsUnspecified);
......
......@@ -216,9 +216,9 @@ class C
var textView = workspace.Documents.Single().GetTextView();
var handler = new EncapsulateFieldCommandHandler(
exportProvider.GetExportedValue<IThreadingContext>(),
workspace.GetService<IThreadingContext>(),
workspace.GetService<ITextBufferUndoManagerProvider>(),
workspace.ExportProvider.GetExportedValue<IAsynchronousOperationListenerProvider>());
workspace.GetService<IAsynchronousOperationListenerProvider>());
var state = handler.GetCommandState(new EncapsulateFieldCommandArgs(textView, textView.TextBuffer));
Assert.True(state.IsUnspecified);
......
......@@ -60,9 +60,9 @@ public void Encapsulate()
{
var args = new EncapsulateFieldCommandArgs(_testDocument.GetTextView(), _testDocument.GetTextBuffer());
var commandHandler = new EncapsulateFieldCommandHandler(
Workspace.ExportProvider.GetExportedValue<IThreadingContext>(),
Workspace.GetService<IThreadingContext>(),
Workspace.GetService<ITextBufferUndoManagerProvider>(),
Workspace.ExportProvider.GetExportedValue<IAsynchronousOperationListenerProvider>());
Workspace.GetService<IAsynchronousOperationListenerProvider>());
commandHandler.ExecuteCommand(args, TestCommandExecutionContext.Create());
}
......
......@@ -10372,7 +10372,7 @@ public void ExtractMethodCommandDisabledInSubmission()
var textView = workspace.Documents.Single().GetTextView();
var handler = new ExtractMethodCommandHandler(
exportProvider.GetExportedValue<IThreadingContext>(),
workspace.GetService<IThreadingContext>(),
workspace.GetService<ITextBufferUndoManagerProvider>(),
workspace.GetService<IInlineRenameService>());
......
......@@ -143,9 +143,9 @@ public void TestExtractMethodCommandHandlerErrorMessage()
callBackService.NotificationCallback = (t, m, s) => called = true;
var handler = new ExtractMethodCommandHandler(
workspace.ExportProvider.GetExportedValue<IThreadingContext>(),
workspace.ExportProvider.GetExportedValue<ITextBufferUndoManagerProvider>(),
workspace.ExportProvider.GetExportedValue<IInlineRenameService>());
workspace.GetService<IThreadingContext>(),
workspace.GetService<ITextBufferUndoManagerProvider>(),
workspace.GetService<IInlineRenameService>());
handler.ExecuteCommand(new ExtractMethodCommandArgs(view, view.TextBuffer), TestCommandExecutionContext.Create());
......
......@@ -20,7 +20,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Rename
Public Class RenameCommandHandlerTests
Private Function CreateCommandHandler(workspace As TestWorkspace) As RenameCommandHandler
Return New RenameCommandHandler(
workspace.ExportProvider.GetExportedValue(Of IThreadingContext)(),
workspace.GetService(Of IThreadingContext)(),
workspace.GetService(Of InlineRenameService))
End Function
......@@ -155,7 +155,7 @@ End Class
view.Caret.MoveTo(New SnapshotPoint(view.TextBuffer.CurrentSnapshot, workspace.Documents.Single(Function(d) d.CursorPosition.HasValue).CursorPosition.Value))
Dim commandHandler As New RenameCommandHandler(
workspace.ExportProvider.GetExportedValue(Of IThreadingContext)(),
workspace.GetService(Of IThreadingContext)(),
workspace.GetService(Of InlineRenameService))
Dim editorOperations = workspace.GetService(Of IEditorOperationsFactoryService)().GetEditorOperations(view)
......@@ -213,7 +213,7 @@ End Class
Dim renameService = workspace.GetService(Of InlineRenameService)()
Dim commandHandler As New RenameCommandHandler(
workspace.ExportProvider.GetExportedValue(Of IThreadingContext)(),
workspace.GetService(Of IThreadingContext)(),
renameService)
Dim session = StartSession(workspace)
......@@ -247,7 +247,7 @@ End Class
Dim renameService = workspace.GetService(Of InlineRenameService)()
Dim commandHandler As New RenameCommandHandler(
workspace.ExportProvider.GetExportedValue(Of IThreadingContext)(),
workspace.GetService(Of IThreadingContext)(),
renameService)
Dim session = StartSession(workspace)
......@@ -293,7 +293,7 @@ Goo f;
Dim renameService = workspace.GetService(Of InlineRenameService)()
Dim editorOperations = workspace.GetService(Of IEditorOperationsFactoryService)().GetEditorOperations(view)
Dim commandHandler As New RenameCommandHandler(
workspace.ExportProvider.GetExportedValue(Of IThreadingContext)(),
workspace.GetService(Of IThreadingContext)(),
renameService)
Assert.True(view.Selection.IsEmpty())
......@@ -338,7 +338,7 @@ class [|$$Goo|] // comment
Dim renameService = workspace.GetService(Of InlineRenameService)()
Dim editorOperations = workspace.GetService(Of IEditorOperationsFactoryService)().GetEditorOperations(view)
Dim commandHandler As New RenameCommandHandler(
workspace.ExportProvider.GetExportedValue(Of IThreadingContext)(),
workspace.GetService(Of IThreadingContext)(),
renameService)
Dim session = StartSession(workspace)
......@@ -395,7 +395,7 @@ Goo f;
Dim renameService = workspace.GetService(Of InlineRenameService)()
Dim editorOperations = workspace.GetService(Of IEditorOperationsFactoryService)().GetEditorOperations(view)
Dim commandHandler As New RenameCommandHandler(
workspace.ExportProvider.GetExportedValue(Of IThreadingContext)(),
workspace.GetService(Of IThreadingContext)(),
renameService)
Dim session = StartSession(workspace)
......@@ -488,7 +488,7 @@ Goo f;
view.Caret.MoveTo(New SnapshotPoint(view.TextBuffer.CurrentSnapshot, workspace.Documents.Single(Function(d) d.CursorPosition.HasValue).CursorPosition.Value))
Dim commandHandler As New RenameCommandHandler(
workspace.ExportProvider.GetExportedValue(Of IThreadingContext)(),
workspace.GetService(Of IThreadingContext)(),
workspace.GetService(Of InlineRenameService))
Dim editorOperations = workspace.GetService(Of IEditorOperationsFactoryService)().GetEditorOperations(view)
Dim session = StartSession(workspace)
......@@ -522,7 +522,7 @@ Goo f;
Dim view = workspace.Documents.Single().GetTextView()
Dim commandHandler As New RenameCommandHandler(
workspace.ExportProvider.GetExportedValue(Of IThreadingContext)(),
workspace.GetService(Of IThreadingContext)(),
workspace.GetService(Of InlineRenameService))
Dim session = StartSession(workspace)
......@@ -575,7 +575,7 @@ Goo f;
Dim view = workspace.Documents.Single().GetTextView()
Dim commandHandler As New RenameCommandHandler(
workspace.ExportProvider.GetExportedValue(Of IThreadingContext)(),
workspace.GetService(Of IThreadingContext)(),
workspace.GetService(Of InlineRenameService))
Dim session = StartSession(workspace)
......@@ -615,7 +615,7 @@ Goo f;
Dim view = workspace.Documents.Single().GetTextView()
Dim commandHandler As New RenameCommandHandler(
workspace.ExportProvider.GetExportedValue(Of IThreadingContext)(),
workspace.GetService(Of IThreadingContext)(),
workspace.GetService(Of InlineRenameService))
Dim session = StartSession(workspace)
......@@ -654,7 +654,7 @@ Goo f;
Dim view = workspace.Documents.Single().GetTextView()
Dim commandHandler As New RenameCommandHandler(
workspace.ExportProvider.GetExportedValue(Of IThreadingContext)(),
workspace.GetService(Of IThreadingContext)(),
workspace.GetService(Of InlineRenameService))
Dim session = StartSession(workspace)
......@@ -710,7 +710,7 @@ Goo f;
Dim view = workspace.Documents.ElementAt(0).GetTextView()
Dim commandHandler As New RenameCommandHandler(
workspace.ExportProvider.GetExportedValue(Of IThreadingContext)(),
workspace.GetService(Of IThreadingContext)(),
workspace.GetService(Of InlineRenameService))
Dim session = StartSession(workspace)
......@@ -777,7 +777,7 @@ Goo f;
Dim view = workspace.Documents.ElementAt(0).GetTextView()
Dim commandHandler As New RenameCommandHandler(
workspace.ExportProvider.GetExportedValue(Of IThreadingContext)(),
workspace.GetService(Of IThreadingContext)(),
workspace.GetService(Of InlineRenameService))
Dim session = StartSession(workspace)
......@@ -835,7 +835,7 @@ class Program
Dim view = workspace.Documents.Single().GetTextView()
Dim editorOperations = workspace.GetService(Of IEditorOperationsFactoryService).GetEditorOperations(view)
Dim commandHandler As New RenameCommandHandler(
workspace.ExportProvider.GetExportedValue(Of IThreadingContext)(),
workspace.GetService(Of IThreadingContext)(),
workspace.GetService(Of InlineRenameService))
view.Caret.MoveTo(New SnapshotPoint(view.TextBuffer.CurrentSnapshot, workspace.Documents.Single(Function(d) d.CursorPosition.HasValue).CursorPosition.Value))
......@@ -876,7 +876,7 @@ partial class [|Program|]
Dim view = workspace.Documents.First(Function(d) d.Name = "Test.cs").GetTextView()
Dim editorOperations = workspace.GetService(Of IEditorOperationsFactoryService).GetEditorOperations(view)
Dim commandHandler As New RenameCommandHandler(
workspace.ExportProvider.GetExportedValue(Of IThreadingContext)(),
workspace.GetService(Of IThreadingContext)(),
workspace.GetService(Of InlineRenameService))
Dim closedDocument = workspace.Documents.First(Function(d) d.Name = "Test2.cs")
......@@ -912,7 +912,7 @@ partial class [|Program|]
Dim renameService = workspace.GetService(Of InlineRenameService)()
Dim commandHandler As New RenameCommandHandler(
workspace.ExportProvider.GetExportedValue(Of IThreadingContext)(),
workspace.GetService(Of IThreadingContext)(),
renameService)
Dim session = StartSession(workspace)
......@@ -952,7 +952,7 @@ partial class [|Program|]
Dim renameService = workspace.GetService(Of InlineRenameService)()
Dim commandHandler As New RenameCommandHandler(
workspace.ExportProvider.GetExportedValue(Of IThreadingContext)(),
workspace.GetService(Of IThreadingContext)(),
renameService)
Dim session = StartSession(workspace)
......@@ -995,7 +995,7 @@ partial class [|Program|]
Dim renameService = workspace.GetService(Of InlineRenameService)()
Dim commandHandler As New RenameCommandHandler(
workspace.ExportProvider.GetExportedValue(Of IThreadingContext)(),
workspace.GetService(Of IThreadingContext)(),
renameService)
Dim session = StartSession(workspace)
......@@ -1033,7 +1033,7 @@ partial class [|Program|]
Dim renameService = workspace.GetService(Of InlineRenameService)()
Dim commandHandler As New RenameCommandHandler(
workspace.ExportProvider.GetExportedValue(Of IThreadingContext)(),
workspace.GetService(Of IThreadingContext)(),
renameService)
Dim session = StartSession(workspace)
......@@ -1070,7 +1070,7 @@ partial class [|Program|]
Dim renameService = workspace.GetService(Of InlineRenameService)()
Dim commandHandler As New RenameCommandHandler(
workspace.ExportProvider.GetExportedValue(Of IThreadingContext)(),
workspace.GetService(Of IThreadingContext)(),
renameService)
Dim session = StartSession(workspace)
......@@ -1107,7 +1107,7 @@ partial class [|Program|]
Dim view = workspace.Documents.Single().GetTextView()
Dim commandHandler As New RenameCommandHandler(
workspace.ExportProvider.GetExportedValue(Of IThreadingContext)(),
workspace.GetService(Of IThreadingContext)(),
workspace.GetService(Of InlineRenameService))
Dim session = StartSession(workspace)
......@@ -1245,7 +1245,7 @@ class [|C$$|]
Dim renameService = workspace.GetService(Of InlineRenameService)()
Dim commandHandler As New RenameCommandHandler(
workspace.ExportProvider.GetExportedValue(Of IThreadingContext)(),
workspace.GetService(Of IThreadingContext)(),
renameService)
Dim session = StartSession(workspace)
......@@ -1290,7 +1290,7 @@ class [|C$$|]
Dim renameService = workspace.GetService(Of InlineRenameService)()
Dim commandHandler As New RenameCommandHandler(
workspace.ExportProvider.GetExportedValue(Of IThreadingContext)(),
workspace.GetService(Of IThreadingContext)(),
renameService)
Dim session = StartSession(workspace)
......@@ -1325,7 +1325,7 @@ class [|C$$|]
Dim renameService = workspace.GetService(Of InlineRenameService)()
Dim commandHandler As New RenameCommandHandler(
workspace.ExportProvider.GetExportedValue(Of IThreadingContext)(),
workspace.GetService(Of IThreadingContext)(),
renameService)
Dim session = StartSession(workspace)
......
......@@ -567,7 +567,7 @@ class C
Dim renameService = workspace.GetService(Of InlineRenameService)()
Dim editorOperations = workspace.GetService(Of IEditorOperationsFactoryService).GetEditorOperations(view)
Dim commandHandler As New RenameCommandHandler(
workspace.ExportProvider.GetExportedValue(Of IThreadingContext)(),
workspace.GetService(Of IThreadingContext)(),
workspace.GetService(Of InlineRenameService))
Dim session = StartSession(workspace)
......@@ -1075,7 +1075,7 @@ End Class
Dim view = workspace.Documents.Single().GetTextView()
Dim editorOperations = workspace.GetService(Of IEditorOperationsFactoryService).GetEditorOperations(view)
Dim commandHandler As New RenameCommandHandler(
workspace.ExportProvider.GetExportedValue(Of IThreadingContext)(),
workspace.GetService(Of IThreadingContext)(),
workspace.GetService(Of InlineRenameService))
Dim textViewService = New TextBufferAssociatedViewService()
......@@ -1159,7 +1159,7 @@ End Class
Dim view = workspace.Documents.Single().GetTextView()
Dim editorOperations = workspace.GetService(Of IEditorOperationsFactoryService).GetEditorOperations(view)
Dim commandHandler As New RenameCommandHandler(
workspace.ExportProvider.GetExportedValue(Of IThreadingContext)(),
workspace.GetService(Of IThreadingContext)(),
workspace.GetService(Of InlineRenameService))
Dim textViewService = New TextBufferAssociatedViewService()
......
......@@ -155,9 +155,9 @@ End Class
Dim textView = workspace.Documents.Single().GetTextView()
Dim handler = New EncapsulateFieldCommandHandler(
workspace.ExportProvider.GetExportedValue(Of IThreadingContext),
workspace.GetService(Of IThreadingContext),
workspace.GetService(Of ITextBufferUndoManagerProvider),
workspace.ExportProvider.GetExportedValue(Of IAsynchronousOperationListenerProvider)())
workspace.GetService(Of IAsynchronousOperationListenerProvider)())
Dim state = handler.GetCommandState(New EncapsulateFieldCommandArgs(textView, textView.TextBuffer))
Assert.True(state.IsUnspecified)
......
......@@ -3386,7 +3386,7 @@ End Namespace"
Dim textView = workspace.Documents.Single().GetTextView()
Dim handler = New ExtractMethodCommandHandler(
workspace.ExportProvider.GetExportedValue(Of IThreadingContext)(),
workspace.GetService(Of IThreadingContext)(),
workspace.GetService(Of ITextBufferUndoManagerProvider)(),
workspace.GetService(Of IInlineRenameService)())
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册