public void ThrowsIfProviderNotFoundForFilePath() { // Given FileSystem fileSystem = new FileSystem(); FilePath path = new FilePath("foo", "/a/b/c.txt"); // When, Then Assert.Throws<KeyNotFoundException>(() => fileSystem.GetFileProvider(path)); }
public void ThrowsForRelativeFilePath() { // Given FileSystem fileSystem = new FileSystem(); FilePath relativePath = new FilePath("A/B/C.txt"); // When, Then Assert.Throws<ArgumentException>(() => fileSystem.GetFileProvider(relativePath)); }
public void ReturnsOtherProviderForFilePath() { // Given FileSystem fileSystem = new FileSystem(); IFileProvider defaultProvider = Substitute.For<IFileProvider>(); IFileProvider fooProvider = Substitute.For<IFileProvider>(); fileSystem.FileProviders.Add(NormalizedPath.DefaultFileProvider.Scheme, defaultProvider); fileSystem.FileProviders.Add("foo", fooProvider); FilePath path = new FilePath("foo", "/a/b/c.txt"); // When IFileProvider result = fileSystem.GetFileProvider(path); // Then Assert.AreEqual(fooProvider, result); }
public void ThrowsForNullPath() { // Given FileSystem fileSystem = new FileSystem(); // When, Then Assert.Throws<ArgumentNullException>(() => fileSystem.GetFileProvider(null)); }