public async Task TestCreateChoreForFlatAsync() { Trace.Listeners.Add(new TextWriterTraceListener(Console.Out)); Trace.AutoFlush = true; // Arrange var chore = new ChoreDTO { Title = "lawn", Description = "mow the lawn", Assignee = 1, DueDate = new DateTime(2020, 05, 05), Completed = false, Recurring = true, }; List <Chore> expectedChores = await _choresRepository.GetAll(); expectedChores.Add(new Chore { Id = 3, // this is what we expect based on DevelopmentDatabaseSetup intialisation Title = "lawn", Description = "mow the lawn", AssignedUser = await _userRepository.Get(1), DueDate = new DateTime(2020, 05, 05), Completed = false, Recurring = true, }); // Act var response = await _choreController.CreateChoreForFlat(chore); // Assert OK result and Chore has been added to repository Assert.IsInstanceOf <OkResult>(response); List <Chore> newChores = await _choresRepository.GetAll(); Assert.AreEqual(expectedChores, newChores); }
public async Task TestCreateChoreForFlatAsync() { // Arrange var chore = new ChoreDTO { Title = "dishes", Description = "do the dishes", Assignee = 1, DueDate = new DateTime(2020, 04, 04), Completed = false, Recurring = true, }; // Act var response = await _choreController.CreateChoreForFlat(chore); // Assert Assert.IsInstanceOf <OkResult>(response); }