protected void SaveServiceComponentResolver(ServiceComponent component, EditServiceComponentWithResolverViewModel model) { if (!model.ResolverServiceDeliveryOrganisation.ServiceDeliveryOrganisationTypeId.HasValue || !(model.ResolverServiceDeliveryOrganisation.ServiceDeliveryOrganisationTypeId > 0)) { return; } component.Resolver.ServiceDeliveryOrganisationType = _serviceDeliveryOrganisationTypeRefDataService.GetById(model.ResolverServiceDeliveryOrganisation.ServiceDeliveryOrganisationTypeId.Value); component.Resolver.ServiceDeliveryOrganisationNotes = model.ResolverServiceDeliveryOrganisation.ServiceDeliveryOrganisationNotes; if (model.ResolverServiceDeliveryUnit.ServiceDeliveryUnitTypeId.HasValue && model.ResolverServiceDeliveryUnit.ServiceDeliveryUnitTypeId > 0) { component.Resolver.ServiceDeliveryUnitType = _serviceDeliveryUnitTypeRefDataService.GetById( model.ResolverServiceDeliveryUnit.ServiceDeliveryUnitTypeId.Value); } else { component.Resolver.ServiceDeliveryUnitType = null; } component.Resolver.ServiceDeliveryUnitNotes = model.ResolverServiceDeliveryUnit.ServiceDeliveryUnitNotes; if (model.ResolverGroup.ResolverGroupTypeId.HasValue && model.ResolverGroup.ResolverGroupTypeId > 0) { var resolverGroupType = _resolverGroupTypeRefDataService.GetById(model.ResolverGroup.ResolverGroupTypeId.Value); component.Resolver.ResolverGroupType = resolverGroupType; var customerSpecificTypeThreshold = _parameterService.GetParameterByNameAndCache <int>(ParameterNames.CustomerSpecificTypeThreshold); if (!resolverGroupType.Visible && _resolverGroupTypeRefDataService.GetNumberOfResolverGroupTypeReferences(resolverGroupType.Id) >= customerSpecificTypeThreshold - 1) { resolverGroupType.Visible = true; _resolverGroupTypeRefDataService.Update(resolverGroupType); } } else { component.Resolver.ResolverGroupType = null; } }
public void ServiceDeliveryOrganisationTypeRefDataService_GetById_CallsRepositoryGetById() { #region Arrange #endregion #region Act _serviceDeliveryOrganisationRefDataService.GetById(1); #endregion #region Assert _serviceDeliveryOrganisationTypeRefDataRepository.Verify(x => x.GetById(It.IsAny <int>()), Times.Once); #endregion }