Exemplo n.º 1
0
        public void GivenNotExistingTodo_Delete_ReturnsFalse()
        {
            var todo = new TodoModel();

            MockRepository.Setup(a => a.Delete(todo.Id));
            var service   = new Service.TodoService(MockRepository.Object);
            var isDeleted = service.Delete(todo.Id);

            Assert.False(isDeleted);
        }
Exemplo n.º 2
0
        public void GivenNotExistingID_Delete_DoesntCallRepositorySave()
        {
            Guid id = Guid.Parse("0a000300-0600-0000-0100-0000f0700001");

            MockRepository.Setup(a => a.Delete(id));
            var service = new Service.TodoService(MockRepository.Object);

            service.Delete(id);

            MockRepository.Verify(a => a.Save(), Times.Never);
        }
Exemplo n.º 3
0
        public void GivenExistingTodo_Delete_ReturnsTrue(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.GetById(todo.Id)).Returns(todo);
            MockRepository.Setup(a => a.Delete(todo.Id));
            var service   = new Service.TodoService(MockRepository.Object);
            var isDeleted = service.Delete(todo.Id);

            Assert.True(isDeleted);
        }