Example #1
0
        public void IndentProject_IndentsModulesWithoutNoIndentAnnotation()
        {
            const string inputCode1 =
                @"Sub Foo()
Dim d As Boolean
d = True
End Sub";

            const string inputCode2 =
                @"'@NoIndent

Sub Foo()
Dim d As Boolean
d = True
End Sub";

            const string expectedCode =
                @"Sub Foo()
    Dim d As Boolean
    d = True
End Sub
";

            using (var explorer = new MockedCodeExplorer(ProjectType.HostProject, new[] { ComponentType.StandardModule, ComponentType.ClassModule }, new[] { inputCode1, inputCode2 })
                                  .SelectFirstProject())
            {
                var module1 = explorer.VbComponents.Object[0].CodeModule;
                var module2 = explorer.VbComponents.Object[1].CodeModule;

                explorer.ExecuteIndenterCommand();

                Assert.AreEqual(expectedCode, module1.Content());
                Assert.AreEqual(inputCode2, module2.Content());
            }
        }
Example #2
0
        public void IndentFolder()
        {
            const string inputCode =
                @"'@Folder ""folder""

Sub Foo()
Dim d As Boolean
d = True
End Sub";

            const string expectedCode =
                @"'@Folder ""folder""

Sub Foo()
    Dim d As Boolean
    d = True
End Sub
";

            using (var explorer = new MockedCodeExplorer(ProjectType.HostProject, new[] { ComponentType.StandardModule, ComponentType.ClassModule }, new[] { inputCode, inputCode })
                                  .SelectFirstCustomFolder())
            {
                var module1 = explorer.VbComponents.Object[0].CodeModule;
                var module2 = explorer.VbComponents.Object[1].CodeModule;

                explorer.ExecuteIndenterCommand();

                Assert.AreEqual(expectedCode, module1.Content());
                Assert.AreEqual(expectedCode, module2.Content());
            }
        }
Example #3
0
        public void IndentModule()
        {
            const string inputCode =
                @"Sub Foo()
Dim d As Boolean
d = True
End Sub";

            const string expectedCode =
                @"Sub Foo()
    Dim d As Boolean
    d = True
End Sub
";

            using (var explorer = new MockedCodeExplorer(inputCode)
                                  .SelectFirstModule())
            {
                explorer.ExecuteIndenterCommand();
                Assert.AreEqual(expectedCode, explorer.VbComponent.Object.CodeModule.Content());
            }
        }