public void ShouldReturnContainingPathForInputPathAboveRootPath(string path, string expected) { // Given FileSystem fileSystem = new FileSystem(); fileSystem.RootPath = "/a/y"; fileSystem.InputPaths.Add("../b"); fileSystem.InputPaths.Add("../x"); fileSystem.FileProviders.Add(string.Empty, GetFileProvider()); // When DirectoryPath inputPathFromFilePath = fileSystem.GetContainingInputPath(new FilePath(path)); DirectoryPath inputPathFromDirectoryPath = fileSystem.GetContainingInputPath(new DirectoryPath(path)); // Then Assert.AreEqual(expected, inputPathFromFilePath?.FullPath); Assert.AreEqual(expected, inputPathFromDirectoryPath?.FullPath); }
public void ShouldReturnContainingPathForRelativeDirectoryPath(string path, string expected) { // Given FileSystem fileSystem = new FileSystem(); fileSystem.RootPath = "/a"; fileSystem.InputPaths.Add("b"); fileSystem.InputPaths.Add("y"); fileSystem.FileProviders.Add(NormalizedPath.DefaultFileProvider.Scheme, GetFileProvider()); // When DirectoryPath inputPath = fileSystem.GetContainingInputPath(new DirectoryPath(path)); // Then Assert.AreEqual(expected, inputPath?.FullPath); }
public void ThrowsForNullPath() { // Given FileSystem fileSystem = new FileSystem(); // When, Then Assert.Throws<ArgumentNullException>(() => fileSystem.GetContainingInputPath(null)); }