public void Save_Action_Will_Call_NotifyChanges_In_Repository() { var book = new Book { Id = 42, ModifiedDate = DateTime.Now }; var model = editBookModelMapper.ModelFromEntity(book); var mock = new Mock <IEntityRepository <Book> >(); var controller = new BooksController(mock.Object, viewBookModelMapper, editBookModelMapper); mock.Setup(repo => repo.GetItem(book.Id)).Returns(book); controller.Save(model); mock.Verify(repo => repo.NotifyItemWasChanged(book)); }
public void Will_Map_Publishers_To_Available_Publishers_Dictionary() { publishers.Add(somePublisher); var model = mapper.ModelFromEntity(new Book()); Assert.That(model.AvailablePublishers.Count(), Is.EqualTo(1)); Assert.That(model.AvailablePublishers.First().Value, Is.EqualTo(somePublisher.Id.ToString())); Assert.That(model.AvailablePublishers.First().Text, Is.EqualTo(somePublisher.Name)); }