public ActionResult Edit(ProductionCalendarRecord productionCalendarRecord) { _productionCalendarSvc.Validate(productionCalendarRecord, new ModelStateValidationRecipient(ModelState)); if (ModelState.IsValid) { _productionCalendarSvc.UpdateRecord(productionCalendarRecord); return(RedirectToAction("Index")); } return(View(productionCalendarRecord)); }
public void Test_ProductionCalendarService_AddRecord() { RepositoryTestHelper.SetUpAdd <ProductionCalendarRecord, IProductionCalendarRepository>(_repositoryMock); var newRecord = new ProductionCalendarRecord { Year = 2018, Month = 3, Day = 1, CalendarDate = new DateTime(2018, 3, 1), WorkingHours = 8 }; var svc = new ProductionCalendarService(_repositoryFactoryMock.Object); var savedRecord = svc.AddRecord(newRecord); _repositoryMock.Verify(m => m.Add(newRecord), Times.Once()); //Assert.That(savedRecord, Is.SameAs(newRecord)); Assert.Same(savedRecord, newRecord); }