public void CreateItem_ShouldReturnNullIfUserIsNotFound() { // Arrange var dbContext = SetupDatabase(nameof(CreateItem_ShouldReturnNullIfUserIsNotFound)); var repository = new TodoItemRepository(dbContext); // Act var result = repository.CreateItem(3, new CreateTodoItemDto()); // Assert Assert.Null(result); }
public void CreateItem_ShouldReturnNullIfListIsNotFound() { // Arrange var dbContext = SetupDatabase(nameof(CreateItem_ShouldReturnNullIfListIsNotFound)); var repository = new TodoItemRepository(dbContext); var input = new CreateTodoItemDto { TodoListId = 10, Description = "Cheese" }; // Act var result = repository.CreateItem(1, input); // Assert Assert.Null(result); }
public void CreateItem_ShouldCreateItem() { // Arrange var dbContext = SetupDatabase(nameof(CreateItem_ShouldCreateItem)); var repository = new TodoItemRepository(dbContext); var input = new CreateTodoItemDto { TodoListId = 1, Description = "Cheese" }; // Act var result = repository.CreateItem(1, input); // Assert Assert.NotNull(result); var item = dbContext.TodoItems.FirstOrDefault(t => t.Description == "Cheese"); Assert.NotNull(item); }