示例#1
0
        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);
        }
示例#2
0
        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);
        }