コード例 #1
0
ファイル: SlothParserShould.cs プロジェクト: Suui/SlothUnit
        public void remove_double_quotes_for_paths_with_spaces()
        {
            var rootPathWithSpaces = "\"" + Path.Combine(SolutionPath, Path.Combine(TestProjectPath, "Path With Spaces")) + "\"";

            var testFiles = SlothParser.RetrieveTestFilesIn(rootPathWithSpaces);

            testFiles.Count.Should().Be(1);
        }
コード例 #2
0
ファイル: SlothParserShould.cs プロジェクト: Suui/SlothUnit
        public void retrieve_all_the_test_files_in_the_root_directory()
        {
            var rootPath = Path.Combine(SolutionPath, Path.Combine(TestProjectPath, "SlothParserShould"));

            var testFiles = SlothParser.RetrieveTestFilesIn(rootPath);

            testFiles.Count.Should().Be(6);
        }
コード例 #3
0
ファイル: CodeGeneratorShould.cs プロジェクト: Suui/SlothUnit
        public void generate_the_file_in_an_equivalent_subfolder()
        {
            var testFiles = SlothParser.RetrieveTestFilesIn(CodeGenerationTestPath);

            SlothGenerator.Generate(testFiles);

            File.Exists(Path.Combine(GeneratedFolderPath, "CodeGeneration", "SubFolder", "TestFileInASubFolder.generated.h"))
            .Should().BeTrue();
        }
コード例 #4
0
ファイル: CodeGeneratorShould.cs プロジェクト: Suui/SlothUnit
        public void generate_the_file_for_a_class_with_multiple_methods()
        {
            var testFiles = SlothParser.RetrieveTestFilesIn(CodeGenerationTestPath);

            SlothGenerator.Generate(testFiles);

            var generatedFile = RetrieveFile(Path.Combine(GeneratedFolderPath, "CodeGeneration"), "ClassWithMultipleTestMethods.generated.h");

            File.ReadAllText(generatedFile).Should().EndWithEquivalent(ExpectedCodeFor.AClassWithMultipleTestMethods);
        }
コード例 #5
0
ファイル: CodeGeneratorShould.cs プロジェクト: Suui/SlothUnit
        public void generate_the_file_starting_with_pragma_include_and_global_variable()
        {
            var testFiles = SlothParser.RetrieveTestFilesIn(CodeGenerationTestPath);

            SlothGenerator.Generate(testFiles);

            var generatedFile = RetrieveFile(Path.Combine(GeneratedFolderPath, "CodeGeneration"), "StartOfTheFile.generated.h");

            File.ReadAllText(generatedFile).Should().StartWithEquivalent(ExpectedCodeFor.TheStartOfTheFile);
        }
コード例 #6
0
        public void contain_the_properties_set_in_the_attributes()
        {
            var filePath   = Path.Combine(TestProjectPath, "TestMethodShould.h");
            var testFile   = new SlothParser().TryGetTestFileFrom(filePath);
            var testMethod = testFile.TestClasses.Single().TestMethods[0];

            testMethod.TestProperties.ToList().Should().Contain(new TestProperty("Test"));
            testMethod.TestProperties.ToList().Should().Contain(new TestProperty("OneProperty"));
            testMethod.TestProperties.ToList().Should().Contain(new TestProperty("TwoProperties"));
            testMethod.TestProperties.ToList().Should().Contain(new TestProperty("ThreeProperties"));
        }
コード例 #7
0
ファイル: CodeGeneratorShould.cs プロジェクト: Suui/SlothUnit
        public void add_the_generated_files_to_the_included_tests_file()
        {
            var testFiles = SlothParser.RetrieveTestFilesIn(CodeGenerationTestPath);

            SlothGenerator.GenerateIncludedTestsFile();
            SlothGenerator.Generate(testFiles);

            var includedTestsFile = RetrieveFile(GeneratedFolderPath, NameOfThe.IncludedTestsFile);

            File.ReadAllText(includedTestsFile).Contains(@"#include ""CodeGeneration\SubFolder\RetrievedIncludeFile.generated.h""")
            .Should().BeTrue();
        }
コード例 #8
0
        private static void Main(string[] args)
        {
            if (args.Length == 1)
            {
                Console.WriteLine("SlothUnit: Parsing project files...");
                var rootPath  = args.Single();
                var testFiles = SlothParser.RetrieveTestFilesIn(rootPath);

                Console.WriteLine("SlothUnit: Generating code...");
                var slothGenerator = SlothGenerator.For(rootPath);
                slothGenerator.GenerateMainFile();
                slothGenerator.GenerateIncludedTestsFile();
                slothGenerator.Generate(testFiles);
            }
            else
            {
                Console.WriteLine("Error: No root path parameter specified");
            }
        }