public void ClearCacheAsync_should_ignore_errors() { _directory.Exists(Arg.Any <string>()).Returns(true); _directory.GetFiles(_folderPath).Returns(new[] { "c:\\file.txt", "boot.sys" }); _file.When(x => x.Delete(Arg.Any <string>())) .Do(x => throw new DivideByZeroException()); Func <Task> act = () => _cacheCleaner.ClearCacheAsync(); act.Should().NotThrow(); }
public void Clear_should_ignore_errors() { _directory.Exists(Arg.Any <string>()).Returns(true); _directory.GetFiles(FolderPath).Returns(new[] { "c:\\file.txt", "boot.sys" }); _file.When(x => x.Delete(Arg.Any <string>())) .Do(x => { throw new DivideByZeroException(); }); Func <Task> act = async() => { await _cache.ClearAsync(); }; act.ShouldNotThrow(); }