Example #1
0
        public void Create_CallRepositorySave()
        {
            var todo = new TodoModel();

            MockRepository.Setup(a => a.Save());

            var service = new Service.TodoService(MockRepository.Object);

            service.Create(todo);

            MockRepository.Verify(a => a.Save(), Times.Once);
        }
Example #2
0
        public void GivenCorrectTodo_Create_ReturnCorrectTodo(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)
            };

            var repositoryTodo = new TodoModel();

            MockRepository.Setup(a => a.Insert(todo)).Returns(repositoryTodo);
            var service     = new Service.TodoService(MockRepository.Object);
            var serviceTodo = service.Create(todo);

            Assert.Equal(serviceTodo, repositoryTodo);
        }