public async void ScanFileAsync_GivenFileHasBeenRemoved_ScanResultShouldBeVirus() { A.CallTo(() => fileAccess.FileExists(FileName)).Returns(false); var result = await virusScanner.ScanFileAsync(A.Dummy <byte[]>(), A.Dummy <string>()); Assert.Equal(ScanResult.Virus, result); }
private ScanResult GetScanResult(string fileName) { if (fileAccess.FileExists(fileName)) { try { fileAccess.DeleteFile(fileName); } catch (IOException) { // If we can't delete the file just leave it } return(ScanResult.Clean); } return(ScanResult.Virus); }