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); }
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); }
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(); }
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); }
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); }
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(); }
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"); } }