public void should_return_false_when_file_name_contains_invalid_characters() { var pathProvider = new FileSystemVirtualPathProvider(); pathProvider.RegisterContentDirectory("/yada"); pathProvider.FileExists("/yada\""); }
public void ProviderShouldCallFileSystemFileExists() { var stream = new MemoryStream(); var fileProvider = new Mock<IFileSystem>(); fileProvider.Setup(p => p.OpenFile("1001/media.jpg")).Returns(stream); var provider = new FileSystemVirtualPathProvider("media", new Lazy<IFileSystem>(() => fileProvider.Object)); provider.FileExists("~/media/1001/media.jpg"); fileProvider.Verify(p => p.FileExists("1001/media.jpg"), Times.Once); }
public void ProviderShouldCallFileSystemFileExists() { var stream = new MemoryStream(); var fileProvider = new Mock <IFileSystem>(); fileProvider.Setup(p => p.OpenFile("1001/media.jpg")).Returns(stream); var provider = new FileSystemVirtualPathProvider("media", new Lazy <IFileSystem>(() => fileProvider.Object)); provider.FileExists("~/media/1001/media.jpg"); fileProvider.Verify(p => p.FileExists("1001/media.jpg"), Times.Once); }
public void ProviderShouldCallFileSystemFileExists() { using (MemoryStream stream = new MemoryStream()) { // Arrange Mock <IFileSystem> fileProvider = new Mock <IFileSystem>(); fileProvider.Setup(p => p.OpenFile("1010/media.jpg")).Returns(stream); FileSystemVirtualPathProvider provider = new FileSystemVirtualPathProvider("media", new Lazy <IFileSystem>(() => fileProvider.Object)); // Act provider.FileExists("~/media/1010/media.jpg"); // Assert fileProvider.Verify(p => p.FileExists("1010/media.jpg"), Times.Once); } }
public void ProviderShouldCallFileSystemFileExists() { using (MemoryStream stream = new MemoryStream()) { // Arrange Mock<IFileSystem> fileProvider = new Mock<IFileSystem>(); fileProvider.Setup(p => p.OpenFile("1010/media.jpg")).Returns(stream); FileSystemVirtualPathProvider provider = new FileSystemVirtualPathProvider("media", new Lazy<IFileSystem>(() => fileProvider.Object)); // Act provider.FileExists("~/media/1010/media.jpg"); // Assert fileProvider.Verify(p => p.FileExists("1010/media.jpg"), Times.Once); } }