コード例 #1
0
        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());
        }
コード例 #2
0
        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());
        }
コード例 #3
0
 public void Save(TimeEntryViewModel model)
 {
     wasCalled = true;
 }