public void DeleteFiles_DeleteNonexistentFiles_ReportFilesNotFound() { //Arrange var logger = new TestReportLogger(); Report.AttachLogger(logger); var pattern = "SomeFile.txt"; //Act FileLibrary.DeleteFiles(testFilesDirPath, pattern); //Assert Report.DetachLogger(logger); Assert.AreEqual( string.Format("No files have been found in '{0}' with the pattern '{1}'.", testFilesDirPath, pattern), logger.LastLogMessage); }
public void DeleteFiles_DeleteFile_ReportFileDeleted() { //Arrange var logger = new TestReportLogger(); Report.AttachLogger(logger); var fileName = Path.Combine(testFilesDirPath, "SomeFile.txt"); File.WriteAllText(fileName, "Some text"); var pattern = "SomeFile.txt"; //Act FileLibrary.DeleteFiles(testFilesDirPath, pattern); //Assert Report.DetachLogger(logger); Assert.AreEqual( string.Format("File has been deleted: {0}", fileName), logger.LastLogMessage); Assert.IsTrue(!File.Exists(fileName)); }