public async Task GetCategories_GetAllCategories_ReturnList(string sub1, string sub2, string sub3) { // Arrange List <string> expectedResult = new List <string>(); expectedResult.Add(sub1); expectedResult.Add(sub2); expectedResult.Add(sub3); IArchiveManager archiveManager = new ArchiveManager(archiveService, folderHandlerService); // Act var actualResult = await archiveManager.GetCategories(); // Assert Assert.IsTrue(actualResult.SuccessValue.Count == expectedResult.Count); }
public async Task GetCategories_IOException_ReturnEmptyList() { // Arrange List <string> expectedResult = new List <string>(); string currentDirectory = Environment.CurrentDirectory; string projectDirectory = Directory.GetParent(currentDirectory).FullName; string targetPath = $"{projectDirectory}\\logs"; mockFolderHandlerService.Setup(x => x.GetSubFolders(targetPath)).Throws(new IOException()); IArchiveManager archiveManager = new ArchiveManager(mockArchiveService.Object, mockFolderHandlerService.Object); // Act var actualResult = await archiveManager.GetCategories(); // Assert Assert.IsTrue(actualResult.SuccessValue.Count == expectedResult.Count); }
public async Task GetCategories_SubFoldersGet_ReturnList(string sub1, string sub2, string sub3) { // Arrange List <string> expectedResult = new List <string>(); expectedResult.Add(sub1); expectedResult.Add(sub2); expectedResult.Add(sub3); string currentDirectory = Environment.CurrentDirectory; string projectDirectory = Directory.GetParent(currentDirectory).FullName; string targetPath = $"{projectDirectory}\\logs"; mockFolderHandlerService.Setup(x => x.GetSubFolders(targetPath)).Returns(Task.FromResult(expectedResult)); IArchiveManager archiveManager = new ArchiveManager(mockArchiveService.Object, mockFolderHandlerService.Object); // Act var actualResult = await archiveManager.GetCategories(); // Assert Assert.IsTrue(actualResult.SuccessValue.Count == expectedResult.Count); }