public async Task POST_WebjobLogs_Returns_Valid_List_Of_Downloadable_Items() { // Arrange ConfigureDownloadableFileController(); // Act IActionResult actualResult = await _TestDownloadableFileController.WebjobLogs("WebjobLogsPath"); Assert.NotNull(actualResult); var expectedViewResult = actualResult as ViewResult; Assert.NotNull(expectedViewResult); // Assert var actualDownloadableItems = expectedViewResult.Model as List <IDownloadableItem>; Assert.NotNull( actualDownloadableItems, "Expected the model to have returned an list of downloadable items [IEnumerable<IDownloadableItem>]"); Assert.AreEqual(3, actualDownloadableItems.Count, "Expected the tree configured items to have been returned"); IDownloadableItem directoryTwo = actualDownloadableItems.Find(x => x.Filepath == "Directory2"); Assert.NotNull(directoryTwo); Assert.AreEqual( "Directory2", directoryTwo.Filepath, "Expected Directory2 to have been returned as it was configured as a response at the beginning of this test"); }
public async Task POST_WebjobLogs_Defaults_To_Base_Logs_Path_When_Not_Provided(string filePath, string expectedPath) { // Arrange string actualPath = string.Empty; var configurableDownloadableFileBusinessLogic = new Mock <IDownloadableFileBusinessLogic>(); configurableDownloadableFileBusinessLogic .Setup(x => x.GetListOfDownloadableItemsFromPathAsync(It.IsAny <string>())) .Callback((string fp) => { actualPath = fp; }) .ReturnsAsync(new List <IDownloadableItem>()); var sharedBusinessLogic = IocContainer.Resolve <ISharedBusinessLogic>(); var webService = IocContainer.Resolve <IWebService>(); _TestDownloadableFileController = new DownloadableFileController( configurableDownloadableFileBusinessLogic.Object, null, webService, sharedBusinessLogic); // Act await _TestDownloadableFileController.WebjobLogs(filePath); // Assert Assert.AreEqual(expectedPath, actualPath); }