public async Task TaskService_AddComment_CommentAddedInDatabase() { var comment = new Comment { Text = "My new comment", UserId = null }; var taskService = new TaskService(_dbContext); await taskService.AddCommentAsync(_task.Id, comment); _dbContext.Tasks.FirstOrDefault(x => x.Id == _task.Id).Comments.Should().Contain(comment); }
public void TaskService_AddComment_ThrowsDatabaseUpdateException() { var taskService = new TaskService(null); Assert.ThrowsAsync <DatabaseUpdateException>(() => taskService.AddCommentAsync("bob", new Comment())); }
public void TaskService_AddComment_ThrowsNoDatabaseObjectFoundException() { var taskService = new TaskService(_dbContext); Assert.ThrowsAsync <NoDatabaseObjectFoundException>(() => taskService.AddCommentAsync("bob", new Comment())); }