public async Task Clear_should_return_if_folder_absent() { _directory.Exists(Arg.Any <string>()).Returns(false); await _cache.ClearAsync(); _directory.DidNotReceive().GetFiles(Arg.Any <string>()); }
public async Task Clear_should_remove_all() { var fileSystem = new MockFileSystem(); _cache = new DirectoryImageCache(_folderPath, 2, fileSystem); fileSystem.AddFile(Path.Combine(_folderPath, "*****@*****.**"), new MockFileData("")); fileSystem.AddFile(Path.Combine(_folderPath, "*****@*****.**"), new MockFileData("")); fileSystem.AllFiles.Count().Should().Be(2); await _cache.ClearAsync(); fileSystem.AllFiles.Count().Should().Be(0); }
public async void Clear_should_remove_all() { var fileSystem = new MockFileSystem(); _cache = new DirectoryImageCache(FolderPath, 2, fileSystem); fileSystem.AddFile($"{FolderPath}\\[email protected]", new MockFileData("")); fileSystem.AddFile($"{FolderPath}\\[email protected]", new MockFileData("")); fileSystem.AllFiles.Count().Should().Be(2); await _cache.ClearAsync(); fileSystem.AllFiles.Count().Should().Be(0); }