public async Task PostShouldAddAnalysisAsync() { //arrange var mockRepo = new Mock <IRepository>(); var inputVideoHistory = new VideoHistory() { Email = "*****@*****.**", VideoUrl = "ABC", AverageSentimentScore = 0.5, ChannelName = "Mathemars" }; var controller = new UserSentimentHistoryController(mockRepo.Object); //act var result = await controller.PostAsync(inputVideoHistory); //assert Assert.IsAssignableFrom <CreatedAtActionResult>(result); }
public async Task PostShouldHandleRequestsAsync() { //arrange var mockRepo = new Mock <IRepository>(); mockRepo.Setup(x => x.AddAnalysisAsync(It.IsAny <AverageSentiment>(), It.IsAny <Creator>())).Throws(new Persistence.CreatorDoesNotExistException()); var inputVideoHistory = new VideoHistory() { Email = "*****@*****.**", VideoUrl = "ABC", AverageSentimentScore = 0.5, ChannelName = "Mathemars" }; var controller = new UserSentimentHistoryController(mockRepo.Object); //act var result = await controller.PostAsync(inputVideoHistory); //assert Assert.IsAssignableFrom <BadRequestResult>(result); }