public void Complete_saves_the_completed_todo()
        {
            var toDo = new ToDo();

            _toDoCompleter.Complete(toDo);

            _toDoWriter.Received().Save(toDo);
        }
Beispiel #2
0
 private static ToDoDto MapToDto(ToDo todo)
 {
     return new ToDoDto
     {
         Id = todo.Id,
         Description = todo.Description
     };
 }
Beispiel #3
0
        public void Create_post_saves_a_new_to_do()
        {
            var newToDo = new ToDo();

            _controller.Create(newToDo);

            _toDoWriter.Received().Save(newToDo);
        }
        public void Complete_marks_todo_completed()
        {
            _toDoWriter = NSubstitute.Substitute.For<IToDoWriter>();
            var toDo = new ToDo() {IsComplete = false};

            _toDoCompleter.Complete(toDo);

            toDo.IsComplete.Should().Be(true);
        }
Beispiel #5
0
        public void Save_persists_the_id()
        {
            var expectedId = 3;
            var toDo = new ToDo() { Id = expectedId };

            _writer.Save(toDo);

            _toDoDtoRepository.Received().Save(Arg.Is<ToDoDto>(t => t.Id == expectedId));
        }
Beispiel #6
0
        public void Save_persists_the_description()
        {
            var expectedDescription = "All The Things";
            var toDo = new ToDo() { Description = expectedDescription };

            _writer.Save(toDo);

            _toDoDtoRepository.Received().Save(Arg.Is<ToDoDto>(t => t.Description == expectedDescription));
        }
Beispiel #7
0
 public void Complete(ToDo toDo)
 {
     toDo.IsComplete = true;
     _toDoWriter.Save(toDo);
 }
Beispiel #8
0
 public void Save(ToDo todo)
 {
     var dto = MapToDto(todo);
     _toDoDtoRepository.Save(dto);
 }
Beispiel #9
0
 public ActionResult Create(ToDo toDo)
 {
     _toDoWriter.Save(toDo);
     return RedirectToAction("Index");
 }