public void DomainTypeRefDataService_Update_CallSaveChanges() { #region Arrange var domain = new DomainTypeRefData() { Id = 4, DomainName = "MJJ Management", }; #endregion #region Act _domainTypeRefDataService.Update(domain); #endregion #region Assert _mockDomainTypeRefDataRepository.Verify(x => x.Update(It.IsAny <DomainTypeRefData>()), Times.Once()); _mockUnitOfWork.Verify(x => x.Save(), Times.Exactly(1)); #endregion }
public ActionResult Edit(EditServiceDomainViewModel model) { if (_appUserContext.Current.CurrentCustomer == null || _appUserContext.Current.CurrentCustomer.Id == 0) { return(GetRedirect(model.EditLevel)); } if (_contextManager.RequestManager.Form[FormValuesNames.Return] != null) { return(GetRedirect(model.EditLevel, model.ServiceDomain.ServiceDeskId)); } if (ModelState.IsValid) { var serviceDomain = _serviceDomainService.GetById(model.ServiceDomain.Id); if (serviceDomain == null) { return(GetRedirect(model.EditLevel, model.ServiceDomain.ServiceDeskId)); } var now = DateTime.Now; serviceDomain.DomainTypeId = model.ServiceDomain.DomainTypeId; serviceDomain.AlternativeName = model.ServiceDomain.AlternativeName; serviceDomain.DiagramOrder = model.ServiceDomain.DiagramOrder ?? 5; serviceDomain.UpdatedBy = _contextManager.UserManager.Name; serviceDomain.UpdatedDate = now; _serviceDomainService.Update(Mapper.Map <ServiceDomain>(serviceDomain)); var customerSpecificTypeThreshold = _parameterService.GetParameterByNameAndCache <int>(ParameterNames.CustomerSpecificTypeThreshold); var domainType = _domainTypeRefDataService.GetById(serviceDomain.DomainTypeId); if (!domainType.Visible && _domainTypeRefDataService.GetNumberOfDomainTypeReferences(serviceDomain.DomainTypeId) >= customerSpecificTypeThreshold) { domainType.Visible = true; _domainTypeRefDataService.Update(domainType); } return(GetRedirect(model.EditLevel, model.ServiceDomain.ServiceDeskId)); } return(View("Edit" + model.EditLevel, model)); }