Example #1
0
        public void ImplementInterface_PropertySet_AllTypes()
        {
            //Input
            const string inputCode1 =
                @"Public Sub Foo()
End Sub

Public Function Bar(ByVal a As Integer) As Boolean
End Function

Public Property Get Buz(ByVal a As Boolean) As Integer
End Property

Public Property Let Buz(ByVal a As Boolean, ByRef value As Integer)
End Property";

            const string inputCode2 =
                @"Implements Class1";

            //Expectation
            const string expectedCode =
                @"Implements Class1

Private Sub Class1_Foo()
    Err.Raise 5 'TODO implement interface member
End Sub

Private Function Class1_Bar(ByVal a As Integer) As Boolean
    Err.Raise 5 'TODO implement interface member
End Function

Private Property Get Class1_Buz(ByVal a As Boolean) As Integer
    Err.Raise 5 'TODO implement interface member
End Property

Private Property Let Class1_Buz(ByVal a As Boolean, ByRef value As Integer)
    Err.Raise 5 'TODO implement interface member
End Property
";

            var builder = new MockVbeBuilder();
            var project = builder.ProjectBuilder("TestProject1", ProjectProtection.Unprotected)
                          .AddComponent("Class1", ComponentType.ClassModule, inputCode1)
                          .AddComponent("Class2", ComponentType.ClassModule, inputCode2)
                          .Build();
            var vbe       = builder.AddProject(project).Build();
            var component = project.Object.VBComponents[1];

            var(state, rewritingManager) = MockParser.CreateAndParseWithRewritingManager(vbe.Object);
            using (state)
            {
                var qualifiedSelection = new QualifiedSelection(new QualifiedModuleName(component), Selection.Home);

                var refactoring = new ImplementInterfaceRefactoring(vbe.Object, state, null, rewritingManager);
                refactoring.Refactor(qualifiedSelection);

                var actualCode = component.CodeModule.Content();
                Assert.AreEqual(expectedCode, actualCode);
            }
        }
        public void ImplementsInterfaceInUserFormModule()
        {
            const string interfaceCode = @"Option Explicit
Public Sub DoSomething()
End Sub
";
            const string initialCode   = @"Implements IInterface";
            const string expectedCode  = @"Implements IInterface

Private Sub IInterface_DoSomething()
    Err.Raise 5 'TODO implement interface member
End Sub
";

            var vbe = new MockVbeBuilder()
                      .ProjectBuilder("TestProject", ProjectProtection.Unprotected)
                      .AddComponent("IInterface", ComponentType.ClassModule, interfaceCode)
                      .AddComponent("Form1", ComponentType.UserForm, initialCode, Selection.Home)
                      .MockVbeBuilder()
                      .Build();

            var project   = vbe.Object.VBProjects[0];
            var component = project.VBComponents["Form1"];

            using (var state = MockParser.CreateAndParse(vbe.Object))
            {
                var qualifiedSelection = new QualifiedSelection(new QualifiedModuleName(component), Selection.Home);

                var refactoring = new ImplementInterfaceRefactoring(vbe.Object, state, null);
                refactoring.Refactor(qualifiedSelection);

                var rewriter = state.GetRewriter(component);
                Assert.AreEqual(expectedCode, rewriter.GetText());
            }
        }
Example #3
0
        public void ImplementInterface_PartiallyImplementedInterface()
        {
            //Input
            const string inputCode1 =
                @"Public Property Get a() As String
End Property
Public Property Let a(RHS As String)
End Property
Public Property Get b() As String
End Property
Public Property Let b(RHS As String)
End Property";

            const string inputCode2 =
                @"Implements Class1

Private Property Let Class1_b(RHS As String)
End Property";

            //Expectation
            const string expectedCode =
                @"Implements Class1

Private Property Let Class1_b(RHS As String)
End Property

Private Property Get Class1_a() As String
    Err.Raise 5 'TODO implement interface member
End Property

Private Property Let Class1_a(ByRef RHS As String)
    Err.Raise 5 'TODO implement interface member
End Property

Private Property Get Class1_b() As String
    Err.Raise 5 'TODO implement interface member
End Property
";

            var builder = new MockVbeBuilder();
            var project = builder.ProjectBuilder("TestProject1", ProjectProtection.Unprotected)
                          .AddComponent("Class1", ComponentType.ClassModule, inputCode1)
                          .AddComponent("Class2", ComponentType.ClassModule, inputCode2)
                          .Build();
            var vbe       = builder.AddProject(project).Build();
            var component = project.Object.VBComponents[1];

            var(state, rewritingManager) = MockParser.CreateAndParseWithRewritingManager(vbe.Object);
            using (state)
            {
                var qualifiedSelection = new QualifiedSelection(new QualifiedModuleName(component), Selection.Home);

                var refactoring = new ImplementInterfaceRefactoring(vbe.Object, state, null, rewritingManager);
                refactoring.Refactor(qualifiedSelection);

                var actualCode = component.CodeModule.Content();
                Assert.AreEqual(expectedCode, actualCode);
            }
        }
        public void ImplementInterface_Procedure_ClassHasOtherProcedure()
        {
            //Input
            const string inputCode1 =
                @"Public Sub Foo()
End Sub";

            const string inputCode2 =
                @"Implements Class1
Public Sub Bar()
End Sub";

            var selection = new Selection(1, 1, 1, 1);

            //Expectation
            const string expectedCode =
                @"Implements Class1

Private Sub Class1_Foo()
    Err.Raise 5 'TODO implement interface member
End Sub

Public Sub Bar()
End Sub";

            //Arrange
            var builder = new MockVbeBuilder();
            var project = builder.ProjectBuilder("TestProject1", vbext_ProjectProtection.vbext_pp_none)
                          .AddComponent("Class1", vbext_ComponentType.vbext_ct_ClassModule, inputCode1)
                          .AddComponent("Class2", vbext_ComponentType.vbext_ct_ClassModule, inputCode2)
                          .Build();
            var vbe       = builder.AddProject(project).Build();
            var component = project.Object.VBComponents.Item(1);

            var mockHost = new Mock <IHostApplication>();

            mockHost.SetupAllProperties();
            var parser = MockParser.Create(vbe.Object, new RubberduckParserState(new Mock <ISinks>().Object));

            parser.Parse(new CancellationTokenSource());
            if (parser.State.Status >= ParserState.Error)
            {
                Assert.Inconclusive("Parser Error");
            }

            var qualifiedSelection = new QualifiedSelection(new QualifiedModuleName(component), selection);
            var module             = project.Object.VBComponents.Item(1).CodeModule;

            //Act
            var refactoring = new ImplementInterfaceRefactoring(vbe.Object, parser.State, null);

            refactoring.Refactor(qualifiedSelection);

            //Assert
            Assert.AreEqual(expectedCode, module.Lines());
        }
Example #5
0
        public override void Execute(object parameter)
        {
            if (Vbe.ActiveCodePane == null)
            {
                return;
            }

            var refactoring = new ImplementInterfaceRefactoring(_state, Editor, new MessageBox());

            refactoring.Refactor();
        }
        protected override void OnExecute(object parameter)
        {
            var activeSelection = SelectionService.ActiveSelection();

            if (!activeSelection.HasValue)
            {
                return;
            }

            var refactoring = new ImplementInterfaceRefactoring(_state, _msgBox, RewritingManager, SelectionService);

            refactoring.Refactor(activeSelection.Value);
        }
Example #7
0
        protected override void OnExecute(object parameter)
        {
            using (var pane = Vbe.ActiveCodePane)
            {
                if (pane.IsWrappingNullReference)
                {
                    return;
                }
            }
            var refactoring = new ImplementInterfaceRefactoring(Vbe, _state, _msgBox);

            refactoring.Refactor();
        }
Example #8
0
        private void _state_StateChanged(object sender, EventArgs e)
        {
            if (_state.Status != ParserState.Ready)
            {
                return;
            }

            _state.StateChanged -= _state_StateChanged;
            var qualifiedSelection = new QualifiedSelection(_model.TargetDeclaration.QualifiedSelection.QualifiedName, new Selection(_insertionLine, 1, _insertionLine, 1));

            _vbe.ActiveCodePane.CodeModule.SetSelection(qualifiedSelection);

            var implementInterfaceRefactoring = new ImplementInterfaceRefactoring(_vbe, _state, _messageBox);

            implementInterfaceRefactoring.Refactor(qualifiedSelection);
        }
Example #9
0
        public void ImplementInterface_PropertySet_WithParam()
        {
            //Input
            const string inputCode1 =
                @"Public Property Set Foo(a)
End Property";

            const string inputCode2 =
                @"Implements Class1";

            var selection = new Selection(1, 1, 1, 1);

            //Expectation
            const string expectedCode =
                @"Implements Class1

Private Property Set Class1_Foo(ByRef a As Variant)
    Err.Raise 5 'TODO implement interface member
End Property
";

            var builder = new MockVbeBuilder();
            var project = builder.ProjectBuilder("TestProject1", ProjectProtection.Unprotected)
                          .AddComponent("Class1", ComponentType.ClassModule, inputCode1)
                          .AddComponent("Class2", ComponentType.ClassModule, inputCode2)
                          .Build();
            var vbe       = builder.AddProject(project).Build();
            var component = project.Object.VBComponents[1];

            var parser = MockParser.Create(vbe.Object, new RubberduckParserState(vbe.Object));

            parser.Parse(new CancellationTokenSource());
            if (parser.State.Status >= ParserState.Error)
            {
                Assert.Inconclusive("Parser Error");
            }

            var qualifiedSelection = new QualifiedSelection(new QualifiedModuleName(component), selection);
            var module             = project.Object.VBComponents[1].CodeModule;

            var refactoring = new ImplementInterfaceRefactoring(vbe.Object, parser.State, null);

            refactoring.Refactor(qualifiedSelection);

            Assert.AreEqual(expectedCode, module.Content());
        }
        public void ImplementInterface_Procedure_ClassHasOtherProcedure()
        {
            //Input
            const string inputCode1 =
                @"Public Sub Foo()
End Sub";

            const string inputCode2 =
                @"Implements Class1

Public Sub Bar()
End Sub";

            //Expectation
            const string expectedCode =
                @"Implements Class1

Public Sub Bar()
End Sub

Private Sub Class1_Foo()
    Err.Raise 5 'TODO implement interface member
End Sub
";

            var builder = new MockVbeBuilder();
            var project = builder.ProjectBuilder("TestProject1", ProjectProtection.Unprotected)
                          .AddComponent("Class1", ComponentType.ClassModule, inputCode1)
                          .AddComponent("Class2", ComponentType.ClassModule, inputCode2)
                          .Build();
            var vbe       = builder.AddProject(project).Build();
            var component = project.Object.VBComponents[1];

            var state = MockParser.CreateAndParse(vbe.Object);

            var qualifiedSelection = new QualifiedSelection(new QualifiedModuleName(component), Selection.Home);

            var refactoring = new ImplementInterfaceRefactoring(vbe.Object, state, null);

            refactoring.Refactor(qualifiedSelection);

            var rewriter = state.GetRewriter(component);

            Assert.AreEqual(expectedCode, rewriter.GetText());
        }
        private void _state_StateChanged(object sender, EventArgs e)
        {
            Debug.WriteLine("ExtractInterfaceRefactoring handles StateChanged...");
            if (_state.Status != ParserState.Ready)
            {
                return;
            }

            Debug.WriteLine("Implementing extracted interface...");
            var qualifiedSelection = new QualifiedSelection(_model.TargetDeclaration.QualifiedSelection.QualifiedName, new Selection(_insertionLine, 1, _insertionLine, 1));

            _editor.SetSelection(qualifiedSelection);

            var implementInterfaceRefactoring = new ImplementInterfaceRefactoring(_state, _editor, _messageBox);

            implementInterfaceRefactoring.Refactor(qualifiedSelection);

            _state.StateChanged -= _state_StateChanged;
        }
Example #12
0
        public void ImplementsInterfaceInUserFormModule()
        {
            const string interfaceCode = @"Option Explicit
Public Sub DoSomething()
End Sub
";
            const string initialCode   = @"Implements IInterface";
            const string expectedCode  = @"Implements IInterface

Private Sub IInterface_DoSomething()
    Err.Raise 5 'TODO implement interface member
End Sub
";
            var          selection     = Selection.Home;
            var          vbe           = new MockVbeBuilder()
                                         .ProjectBuilder("TestProject", ProjectProtection.Unprotected)
                                         .AddComponent("IInterface", ComponentType.ClassModule, interfaceCode)
                                         .AddComponent("Form1", ComponentType.UserForm, initialCode, selection)
                                         .MockVbeBuilder()
                                         .Build();

            var project   = vbe.Object.VBProjects[0];
            var component = project.VBComponents["Form1"];

            var parser = MockParser.Create(vbe.Object, new RubberduckParserState(vbe.Object));

            parser.Parse(new CancellationTokenSource());
            if (parser.State.Status >= ParserState.Error)
            {
                Assert.Inconclusive("Parser Error");
            }

            var qualifiedSelection = new QualifiedSelection(new QualifiedModuleName(component), Selection.Home);
            var module             = component.CodeModule;

            var refactoring = new ImplementInterfaceRefactoring(vbe.Object, parser.State, null);

            refactoring.Refactor(qualifiedSelection);

            Assert.AreEqual(expectedCode, module.Content());
        }
        public void ImplementInterface_PublicVariant(string inputCode1)
        {
            const string inputCode2 =
                @"Implements Class1";

            //Expectation
            const string expectedCode =
                @"Implements Class1

Private Property Get Class1_Foo() As Variant
    Err.Raise 5 'TODO implement interface member
End Property

Private Property Let Class1_Foo(ByVal rhs As Variant)
    Err.Raise 5 'TODO implement interface member
End Property

Private Property Set Class1_Foo(ByVal rhs As Variant)
    Err.Raise 5 'TODO implement interface member
End Property
";

            var builder = new MockVbeBuilder();
            var project = builder.ProjectBuilder("TestProject1", ProjectProtection.Unprotected)
                          .AddComponent("Class1", ComponentType.ClassModule, inputCode1)
                          .AddComponent("Class2", ComponentType.ClassModule, inputCode2)
                          .Build();
            var vbe       = builder.AddProject(project).Build();
            var component = project.Object.VBComponents[1];

            using (var state = MockParser.CreateAndParse(vbe.Object))
            {
                var qualifiedSelection = new QualifiedSelection(new QualifiedModuleName(component), Selection.Home);

                var refactoring = new ImplementInterfaceRefactoring(vbe.Object, state, null);
                refactoring.Refactor(qualifiedSelection);

                var actualCode = state.GetRewriter(component).GetText();
                Assert.AreEqual(expectedCode, actualCode);
            }
        }
Example #14
0
        public void ImplementInterface_Procedure_WithParams()
        {
            //Input
            const string inputCode1 =
                @"Public Sub Foo(ByVal a As Integer, ByRef b, c, d As Long)
End Sub";

            const string inputCode2 =
                @"Implements Class1";

            //Expectation
            const string expectedCode =
                @"Implements Class1

Private Sub Class1_Foo(ByVal a As Integer, ByRef b As Variant, ByRef c As Variant, ByRef d As Long)
    Err.Raise 5 'TODO implement interface member
End Sub
";

            var builder = new MockVbeBuilder();
            var project = builder.ProjectBuilder("TestProject1", ProjectProtection.Unprotected)
                          .AddComponent("Class1", ComponentType.ClassModule, inputCode1)
                          .AddComponent("Class2", ComponentType.ClassModule, inputCode2)
                          .Build();
            var vbe       = builder.AddProject(project).Build();
            var component = project.Object.VBComponents[1];

            var(state, rewritingManager) = MockParser.CreateAndParseWithRewritingManager(vbe.Object);
            using (state)
            {
                var qualifiedSelection = new QualifiedSelection(new QualifiedModuleName(component), Selection.Home);

                var refactoring = new ImplementInterfaceRefactoring(vbe.Object, state, null, rewritingManager);
                refactoring.Refactor(qualifiedSelection);

                var actualCode = component.CodeModule.Content();
                Assert.AreEqual(expectedCode, actualCode);
            }
        }
Example #15
0
        public void ImplementsInterfaceInDocumentModule()
        {
            const string interfaceCode = @"Option Explicit
Public Sub DoSomething()
End Sub
";
            const string initialCode   = @"Implements IInterface";
            const string expectedCode  = @"Implements IInterface

Private Sub IInterface_DoSomething()
    Err.Raise 5 'TODO implement interface member
End Sub
";

            var vbe = new MockVbeBuilder()
                      .ProjectBuilder("TestProject", ProjectProtection.Unprotected)
                      .AddComponent("IInterface", ComponentType.ClassModule, interfaceCode)
                      .AddComponent("Sheet1", ComponentType.Document, initialCode, Selection.Home)
                      .AddProjectToVbeBuilder()
                      .Build();

            var project   = vbe.Object.VBProjects[0];
            var component = project.VBComponents["Sheet1"];

            var(state, rewritingManager) = MockParser.CreateAndParseWithRewritingManager(vbe.Object);
            using (state)
            {
                var qualifiedSelection = new QualifiedSelection(new QualifiedModuleName(component), Selection.Home);

                var refactoring = new ImplementInterfaceRefactoring(vbe.Object, state, null, rewritingManager);
                refactoring.Refactor(qualifiedSelection);

                var actualCode = component.CodeModule.Content();
                Assert.AreEqual(expectedCode, actualCode);
            }
        }
Example #16
0
 private void AddInterfaceMembersToClass(ExtractInterfaceModel model, IModuleRewriter rewriter)
 {
     _implementInterfaceRefactoring.Refactor(model.SelectedMembers.Select(m => m.Member).ToList(), rewriter, model.InterfaceName);
 }
Example #17
0
        public void CreatesMethodStubForAllProcedureKinds()
        {
            //Input
            const string interfaceCode =
                @"Public Sub Foo(ByVal arg1 As Integer, ByVal arg2 As String)
End Sub

Public Function Fizz(b)
End Function

Public Property Get Buzz() As Variant
End Property

Public Property Let Buzz(value)
End Property

Public Property Set Buzz(value)
End Property";

            const string inputCode =
                @"Implements IClassModule";

            //Expectation
            const string expectedCode =
                @"Implements IClassModule

Private Sub IClassModule_Foo(ByVal arg1 As Integer, ByVal arg2 As String)
    Err.Raise 5 'TODO implement interface member
End Sub

Private Function IClassModule_Fizz(ByRef b As Variant) As Variant
    Err.Raise 5 'TODO implement interface member
End Function

Private Property Get IClassModule_Buzz() As Variant
    Err.Raise 5 'TODO implement interface member
End Property

Private Property Let IClassModule_Buzz(ByRef value As Variant)
    Err.Raise 5 'TODO implement interface member
End Property

Private Property Set IClassModule_Buzz(ByRef value As Variant)
    Err.Raise 5 'TODO implement interface member
End Property
";

            var builder = new MockVbeBuilder();
            var project = builder.ProjectBuilder("TestProject1", ProjectProtection.Unprotected)
                          .AddComponent("IClassModule", ComponentType.ClassModule, interfaceCode)
                          .AddComponent("Class1", ComponentType.ClassModule, inputCode)
                          .Build();
            var vbe       = builder.AddProject(project).Build();
            var component = project.Object.VBComponents[1];

            var parser = MockParser.Create(vbe.Object, new RubberduckParserState(vbe.Object));

            parser.Parse(new CancellationTokenSource());
            if (parser.State.Status >= ParserState.Error)
            {
                Assert.Inconclusive("Parser Error");
            }

            var qualifiedSelection = new QualifiedSelection(new QualifiedModuleName(component), Selection.Home);
            var module             = project.Object.VBComponents[1].CodeModule;

            var refactoring = new ImplementInterfaceRefactoring(vbe.Object, parser.State, null);

            refactoring.Refactor(qualifiedSelection);

            Assert.AreEqual(expectedCode, module.Content());
        }
        public void CreatesMethodStubForAllProcedureKinds()
        {
            //Input
            const string interfaceCode =
                @"Public Sub Foo(ByVal arg1 As Integer, ByVal arg2 As String)
End Sub

Public Function Fizz(b)
End Function

Public Property Get Buzz() As Variant
End Property

Public Property Let Buzz(value)
End Property

Public Property Set Buzz(value)
End Property";

            const string inputCode =
                @"Implements IClassModule";

            //Expectation
            const string expectedCode =
                @"Implements IClassModule

Private Sub IClassModule_Foo(ByVal arg1 As Integer, ByVal arg2 As String)
    Err.Raise 5 'TODO implement interface member
End Sub

Private Function IClassModule_Fizz(ByRef b As Variant) As Variant
    Err.Raise 5 'TODO implement interface member
End Function

Private Property Get IClassModule_Buzz() As Variant
    Err.Raise 5 'TODO implement interface member
End Property

Private Property Let IClassModule_Buzz(ByRef value As Variant)
    Err.Raise 5 'TODO implement interface member
End Property

Private Property Set IClassModule_Buzz(ByRef value As Variant)
    Err.Raise 5 'TODO implement interface member
End Property
";

            var builder = new MockVbeBuilder();
            var project = builder.ProjectBuilder("TestProject1", ProjectProtection.Unprotected)
                          .AddComponent("IClassModule", ComponentType.ClassModule, interfaceCode)
                          .AddComponent("Class1", ComponentType.ClassModule, inputCode)
                          .Build();
            var vbe       = builder.AddProject(project).Build();
            var component = project.Object.VBComponents[1];

            using (var state = MockParser.CreateAndParse(vbe.Object))
            {
                var qualifiedSelection = new QualifiedSelection(new QualifiedModuleName(component), Selection.Home);

                var refactoring = new ImplementInterfaceRefactoring(vbe.Object, state, null);
                refactoring.Refactor(qualifiedSelection);

                var rewriter = state.GetRewriter(component);
                Assert.AreEqual(expectedCode, rewriter.GetText());
            }
        }
Example #19
0
        private void AddInterfaceMembersToClass(IModuleRewriter rewriter)
        {
            var implementInterfaceRefactoring = new ImplementInterfaceRefactoring(_vbe, _model.State, _messageBox);

            implementInterfaceRefactoring.Refactor(_model.Members.Select(m => m.Member).ToList(), rewriter, _model.InterfaceName);
        }
Example #20
0
        public void ImplementInterface_PropertySet_AllTypes()
        {
            //Input
            const string inputCode1 =
                @"Public Sub Foo()
End Sub

Public Function Bar(ByVal a As Integer) As Boolean
End Function

Public Property Get Buz(ByVal a As Boolean) As Integer
End Property

Public Property Let Buz(ByVal a As Boolean, ByRef value As Integer)
End Property";

            const string inputCode2 =
                @"Implements Class1";

            var selection = new Selection(1, 1, 1, 1);

            //Expectation
            const string expectedCode =
                @"Implements Class1

Private Sub Class1_Foo()
    Err.Raise 5 'TODO implement interface member
End Sub

Private Function Class1_Bar(ByVal a As Integer) As Boolean
    Err.Raise 5 'TODO implement interface member
End Function

Private Property Get Class1_Buz(ByVal a As Boolean) As Integer
    Err.Raise 5 'TODO implement interface member
End Property

Private Property Let Class1_Buz(ByVal a As Boolean, ByRef value As Integer)
    Err.Raise 5 'TODO implement interface member
End Property
";

            //Arrange
            var builder = new MockVbeBuilder();
            var project = builder.ProjectBuilder("TestProject1", vbext_ProjectProtection.vbext_pp_none)
                          .AddComponent("Class1", vbext_ComponentType.vbext_ct_ClassModule, inputCode1)
                          .AddComponent("Class2", vbext_ComponentType.vbext_ct_ClassModule, inputCode2)
                          .Build();
            var vbe       = builder.AddProject(project).Build();
            var component = project.Object.VBComponents.Item(1);

            var mockHost = new Mock <IHostApplication>();

            mockHost.SetupAllProperties();
            var parser = MockParser.Create(vbe.Object, new RubberduckParserState());

            parser.Parse();
            if (parser.State.Status >= ParserState.Error)
            {
                Assert.Inconclusive("Parser Error");
            }

            var qualifiedSelection = new QualifiedSelection(new QualifiedModuleName(component), selection);
            var module             = project.Object.VBComponents.Item(1).CodeModule;

            //Act
            var refactoring = new ImplementInterfaceRefactoring(vbe.Object, parser.State, null);

            refactoring.Refactor(qualifiedSelection);

            //Assert
            Assert.AreEqual(expectedCode, module.Lines());
        }
        private void AddInterfaceMembersToClass(IModuleRewriter rewriter)
        {
            var implementInterfaceRefactoring = new ImplementInterfaceRefactoring(_declarationFinderProvider, _messageBox, _rewritingManager, _selectionService);

            implementInterfaceRefactoring.Refactor(_model.SelectedMembers.Select(m => m.Member).ToList(), rewriter, _model.InterfaceName);
        }
Example #22
0
        public void ImplementInterface_PropertySet_AllTypes()
        {
            //Input
            const string inputCode1 =
                @"Public Sub Foo()
End Sub

Public Function Bar(ByVal a As Integer) As Boolean
End Function

Public Property Get Buz(ByVal a As Boolean) As Integer
End Property

Public Property Let Buz(ByVal a As Boolean, ByRef value As Integer)
End Property";

            const string inputCode2 =
                @"Implements Class1";

            var selection = Selection.Home;

            //Expectation
            const string expectedCode =
                @"Implements Class1

Private Sub Class1_Foo()
    Err.Raise 5 'TODO implement interface member
End Sub

Private Function Class1_Bar(ByVal a As Integer) As Boolean
    Err.Raise 5 'TODO implement interface member
End Function

Private Property Get Class1_Buz(ByVal a As Boolean) As Integer
    Err.Raise 5 'TODO implement interface member
End Property

Private Property Let Class1_Buz(ByVal a As Boolean, ByRef value As Integer)
    Err.Raise 5 'TODO implement interface member
End Property
";

            var builder = new MockVbeBuilder();
            var project = builder.ProjectBuilder("TestProject1", ProjectProtection.Unprotected)
                          .AddComponent("Class1", ComponentType.ClassModule, inputCode1)
                          .AddComponent("Class2", ComponentType.ClassModule, inputCode2)
                          .Build();
            var vbe       = builder.AddProject(project).Build();
            var component = project.Object.VBComponents[1];

            var parser = MockParser.Create(vbe.Object, new RubberduckParserState(vbe.Object));

            parser.Parse(new CancellationTokenSource());
            if (parser.State.Status >= ParserState.Error)
            {
                Assert.Inconclusive("Parser Error");
            }

            var qualifiedSelection = new QualifiedSelection(new QualifiedModuleName(component), selection);
            var module             = project.Object.VBComponents[1].CodeModule;

            var refactoring = new ImplementInterfaceRefactoring(vbe.Object, parser.State, null);

            refactoring.Refactor(qualifiedSelection);

            Assert.AreEqual(expectedCode, module.Content());
        }