public void ThrowsForNullPath() { // Given IFileSystem fileSystem = new TestFileSystem(); // When, Then Should.Throw <ArgumentNullException>(() => fileSystem.GetContainingInputPathForAbsolutePath(null)); }
public void ShouldReturnContainingPathForInputPathAboveRootPath(string path, string expected) { // Given IFileSystem fileSystem = new TestFileSystem(GetFileProvider()); fileSystem.RootPath = "/a/y"; fileSystem.InputPaths.Add("../b"); fileSystem.InputPaths.Add("../x"); // When DirectoryPath inputPathFromFilePath = fileSystem.GetContainingInputPathForAbsolutePath(new FilePath(path)); DirectoryPath inputPathFromDirectoryPath = fileSystem.GetContainingInputPathForAbsolutePath(new DirectoryPath(path)); // Then Assert.AreEqual(expected, inputPathFromFilePath?.FullPath); Assert.AreEqual(expected, inputPathFromDirectoryPath?.FullPath); }
public void ShouldReturnContainingPathForInputPathAboveRootPath(string path, string expected) { // Given IFileSystem fileSystem = new TestFileSystem(GetFileProvider()); fileSystem.RootPath = "/a/y"; fileSystem.InputPaths.Add("../b"); fileSystem.InputPaths.Add("../x"); // When NormalizedPath inputPath = fileSystem.GetContainingInputPathForAbsolutePath(new NormalizedPath(path)); // Then inputPath.FullPath.ShouldBe(expected); }