public void SaveTimeEntryOnPost() { // Setup var timeEntryRepository = new FakeTimeEntryRepository(); var controller = new TimeEntryController(timeEntryRepository); var model = new TimeEntryViewModel(); model.ProjectName = "Valid Project Name"; controller.Index(model); Assert.IsTrue(timeEntryRepository.SaveWasCalled()); }
public void NoSaveWhenModelIsInvalid() { //Setup var timeEntryRepository = new FakeTimeEntryRepository(); var controller = new TimeEntryController(timeEntryRepository); var model = new TimeEntryViewModel(); model.ProjectName = ""; controller.Index(model); Assert.IsFalse(timeEntryRepository.SaveWasCalled()); }