public void IndentModule_IndentsModule()
        {
            var input =
                @"    Option Explicit   ' at least I used it...
    Sub InverseIndent()
Dim d As Boolean
Dim s As Integer

    End Sub

   Sub RandomIndent()
Dim d As Boolean
            Dim s As Integer

     End Sub
";

            var expected =
                @"Option Explicit                                  ' at least I used it...

Sub InverseIndent()
    Dim d As Boolean
    Dim s As Integer

End Sub

Sub RandomIndent()
    Dim d As Boolean
    Dim s As Integer

End Sub
";

            var builder = new MockVbeBuilder();
            var project = builder.ProjectBuilder("Proj1", ProjectProtection.Unprotected)
                          .AddComponent("Comp1", ComponentType.ClassModule, input)
                          .AddComponent("Comp2", ComponentType.ClassModule, input)
                          .Build();

            var vbe = builder.AddProject(project).Build();

            vbe.Setup(s => s.ActiveCodePane).Returns(project.Object.VBComponents["Comp2"].CodeModule.CodePane);

            using (var state = MockParser.CreateAndParse(vbe.Object))
            {
                var indentCommand = MockIndenter.ArrangeIndentCurrentModuleCommand(vbe, state);
                indentCommand.Execute(null);

                var module1 = project.Object.VBComponents["Comp1"].CodeModule;
                var module2 = project.Object.VBComponents["Comp2"].CodeModule;

                Assert.AreEqual(input, module1.Content());
                Assert.AreEqual(expected, module2.Content());
            }
        }
        public void IndentModule_CanExecute()
        {
            IVBComponent component;
            var          vbe = MockVbeBuilder.BuildFromSingleStandardModule("", out component);

            using (var state = MockParser.CreateAndParse(vbe.Object))
            {
                var indentCommand = MockIndenter.ArrangeIndentCurrentModuleCommand(vbe, state);
                Assert.IsTrue(indentCommand.CanExecute(null));
            }
        }
        public void IndentModule_CanExecute_NullActiveCodePane()
        {
            IVBComponent component;
            var          vbe = MockVbeBuilder.BuildFromSingleStandardModule("", out component);

            vbe.Setup(v => v.ActiveCodePane).Returns((ICodePane)null);

            using (var state = MockParser.CreateAndParse(vbe.Object))
            {
                var indentCommand = MockIndenter.ArrangeIndentCurrentModuleCommand(vbe, state);
                Assert.IsFalse(indentCommand.CanExecute(null));
            }
        }