public void Update_CallsRepositorySave() { var todo = new TodoModel(); MockRepository.Setup(a => a.Save()); var service = new Service.TodoService(MockRepository.Object); service.Update(todo); MockRepository.Verify(a => a.Save(), Times.Once); }
public void GivenExistingTodo_Update_UpdateRetursTrue(string id, string title, string description, TodoStatus status, string createdOn, string dueDate) { var todo = new TodoModel { Id = Guid.Parse(id), Title = title, Description = description, Status = status, CreatedOn = DateTime.Parse(createdOn), DueDate = DateTime.Parse(dueDate) }; MockRepository.Setup(a => a.Update(todo)); todo.Title = "Concert"; todo.Description = "Go to Metallica concert"; var service = new Service.TodoService(MockRepository.Object); var isUpdated = service.Update(todo); Assert.True(isUpdated); }