Exemplo n.º 1
0
        public async void ScanFileAsync_GivenFileHasNotBeenRemoved_FileShouldBeDeleted()
        {
            A.CallTo(() => fileAccess.FileExists(FileName)).Returns(true);

            var result = await virusScanner.ScanFileAsync(A.Dummy <byte[]>(), A.Dummy <string>());

            A.CallTo(() => fileAccess.DeleteFile(FileName)).MustHaveHappened(Repeated.Exactly.Once);
        }
Exemplo n.º 2
0
        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);
        }