public TestCaseSandbox(TestCase testCase, NPath rootTemporaryDirectory, string namePrefix) { _testCase = testCase; _directory = rootTemporaryDirectory.Combine(string.IsNullOrEmpty(namePrefix) ? "linker_tests" : namePrefix); const string tcases_name = "Mono.Linker.Tests.Cases"; var location = testCase.SourceFile.Parent.ToString(); int idx = location.IndexOf(tcases_name + Path.DirectorySeparatorChar); if (idx < 0) { throw new ArgumentException("Unknown test cases location"); } _directory = _directory.Combine(location.Substring(idx + tcases_name.Length + 1)); _directory = _directory.Combine(testCase.SourceFile.FileNameWithoutExtension); _directory.DeleteContents(); InputDirectory = _directory.Combine("input").EnsureDirectoryExists(); OutputDirectory = _directory.Combine("output").EnsureDirectoryExists(); ExpectationsDirectory = _directory.Combine("expectations").EnsureDirectoryExists(); ResourcesDirectory = _directory.Combine("resources").EnsureDirectoryExists(); }
public void Start(string path) { mPath = new NPath(path); mStringPath = path; if (!mPath.DirectoryExists()) { mPath.CreateDirectory(); } mPath.DeleteContents(); }
public TestCaseSandbox(TestCase testCase, NPath rootTemporaryDirectory, string namePrefix) { _testCase = testCase; var name = string.IsNullOrEmpty(namePrefix) ? "linker_tests" : $"{namePrefix}_linker_tests"; _directory = rootTemporaryDirectory.Combine(name); _directory.DeleteContents(); InputDirectory = _directory.Combine("input").EnsureDirectoryExists(); OutputDirectory = _directory.Combine("output").EnsureDirectoryExists(); ExpectationsDirectory = _directory.Combine("expectations").EnsureDirectoryExists(); }
public TestCaseSandbox(TestCase testCase, NPath rootTemporaryDirectory, string namePrefix) { _testCase = testCase; var rootDirectory = rootTemporaryDirectory.Combine(string.IsNullOrEmpty(namePrefix) ? "linker_tests" : namePrefix); var locationRelativeToRoot = testCase.SourceFile.Parent.RelativeTo(testCase.RootCasesDirectory); var suiteDirectory = rootDirectory.Combine(locationRelativeToRoot); _directory = suiteDirectory.Combine(testCase.SourceFile.FileNameWithoutExtension); _directory.DeleteContents(); InputDirectory = _directory.Combine("input").EnsureDirectoryExists(); OutputDirectory = _directory.Combine("output").EnsureDirectoryExists(); ExpectationsDirectory = _directory.Combine("expectations").EnsureDirectoryExists(); ResourcesDirectory = _directory.Combine("resources").EnsureDirectoryExists(); }
public void TestSetup() { _tempDirectory.DeleteContents(); }