public async Task DeleteArchivedFiles_DeleteFailure_ReturnFalse(string startTime, string endTime) { // Arrange mockArchiveService.Setup(x => x.DeleteArchivedFiles(new List <string>())).Returns(Task.FromResult(false)); IArchiveManager archiveManager = new ArchiveManager(mockArchiveService.Object, mockFolderHandlerService.Object); // Act var deleteResult = await archiveManager.DeleteArchivedFiles(DateTimeOffset.Parse(startTime), DateTimeOffset.Parse(endTime)); // Assert Assert.IsFalse(deleteResult.WasSuccessful); }
public async Task DeleteArchivedFiles_IOException_ReturnFalse(string startTime, string endTime, ErrorMessage error) { // Arrange mockArchiveService.Setup(x => x.DeleteArchivedFiles(new List <string>())).Throws(new IOException()); IArchiveManager archiveManager = new ArchiveManager(mockArchiveService.Object, mockFolderHandlerService.Object); // Act var deleteResult = await archiveManager.DeleteArchivedFiles(DateTimeOffset.Parse(startTime), DateTimeOffset.Parse(endTime)); // Assert Assert.IsFalse(deleteResult.WasSuccessful); Assert.IsTrue(deleteResult.ErrorMessage == error); }
public async Task DeleteArchivedFiles_NoValidZips_ReturnFalse(string startTime, string endTime, string message, LogLevel logLevel, LogTarget logTarget) { // Arrange logService.Log(message, logTarget, logLevel, this.ToString(), "Test_Logs"); logService.Log(message, logTarget, logLevel, this.ToString(), "User_Logging"); IArchiveManager archiveManager = new ArchiveManager(archiveService, folderHandlerService); var archiveResult = await archiveManager.ArchiveLogFiles(DateTimeOffset.UtcNow.AddDays(-1), DateTimeOffset.UtcNow.AddDays(1)); // Act var deleteResult = await archiveManager.DeleteArchivedFiles(DateTimeOffset.Parse(startTime), DateTimeOffset.Parse(endTime)); // Assert Assert.IsFalse(deleteResult.WasSuccessful); }