/// <summary> /// Initializes a new instance of the <see cref="ServiceBaseController"/> class. /// </summary> /// <param name="serviceService">The service service.</param> /// <param name="commonService">The common service.</param> /// <param name="codeService">The code service.</param> /// <param name="settings">The settings.</param> /// <param name="generalDescriptionService">The general description service.</param> /// <param name="fintoService">The finto service.</param> /// <param name="serviceAndChannelService">The service and channel service.</param> /// <param name="channelService">The channel service.</param> /// <param name="userOrganizationService">The user organization service.</param> /// <param name="logger">The logger.</param> /// <param name="versionNumber">Open api version.</param> public ServiceBaseController( IServiceService serviceService, ICommonService commonService, ICodeService codeService, IOptions <AppSettings> settings, IGeneralDescriptionService generalDescriptionService, IFintoService fintoService, IServiceAndChannelService serviceAndChannelService, IChannelService channelService, IUserOrganizationService userOrganizationService, ILogger logger, int versionNumber) : base(serviceAndChannelService, serviceService, channelService, userOrganizationService, settings, logger, versionNumber) { this.serviceService = serviceService; this.generalDescriptionService = generalDescriptionService; this.serviceAndChannelService = serviceAndChannelService; this.codeService = codeService; this.fintoService = fintoService; this.commonService = commonService; this.channelService = channelService; this.userOrganizationService = userOrganizationService; pageSize = Settings.PageSize > 0 ? Settings.PageSize : 1000; this.versionNumber = versionNumber; }
/// <summary> /// Constructor. /// </summary> /// <param name="generalDescriptionService">instance of IGeneralDescriptionService</param> /// <param name="codeService">instance of ICodeService</param> /// <param name="fintoService">instance of IFintoService</param> /// <param name="userOrganizationService">instance of IUserOrganizationService</param> /// <param name="logger">instance of ILogger</param> /// <param name="settings">instance of IOptions{AppSettings}</param> public V4GeneralDescriptionController( IGeneralDescriptionService generalDescriptionService, ICodeService codeService, IFintoService fintoService, IUserOrganizationService userOrganizationService, ILogger <V4GeneralDescriptionController> logger, IOptions <AppSettings> settings) : base(generalDescriptionService, codeService, settings, fintoService, logger, userOrganizationService, 4) { }
/// <summary> /// Constructor of service controller /// </summary> /// <param name="service">service service responsible for operation related to service - injected by framework</param> /// <param name="serviceManager">manager responsible for wrapping of individual service call to UI output format - injected by framework</param> /// <param name="fintoService">finto service responsible for operation related to finto stuff - injected by framework</param> /// <param name="logger">logger commponent to support logging - injected by framework</param> public RESTServiceController( IServiceService service, IServiceManager serviceManager, IFintoService fintoService, ILogger <RESTServiceController> logger) : base(logger) { this.service = service; this.serviceManager = serviceManager; this.fintoService = fintoService; }
public ServiceControllerTests() { logger = (new Mock <ILogger <V7ServiceController> >()).Object; fintoServiceMock = new Mock <IFintoService>(); fintoService = fintoServiceMock.Object; id = Guid.NewGuid(); strId = id.ToString(); }
/// <summary> /// Ctor - service validator /// </summary> /// <param name="model">Service model</param> /// <param name="generalDescriptionService">General description service</param> /// <param name="codeService">Code service</param> /// <param name="fintoService">Finto item service</param> /// <param name="commonService">Common service</param> /// <param name="channelService">Channel service</param> /// <param name="newLanguages">Languages that should be validated within lists</param> /// <param name="userRole">User role</param> public ServiceValidator( IVmOpenApiServiceInVersionBase model, IGeneralDescriptionService generalDescriptionService, ICodeService codeService, IFintoService fintoService, ICommonService commonService, IChannelService channelService, IList <string> newLanguages, UserRoleEnum userRole ) : base(model, "Service") { this.generalDescriptionService = generalDescriptionService; if (model == null) { throw new ArgumentNullException(PropertyName, $"{PropertyName} must be defined."); } names = new LocalizedListValidator(model.ServiceNames, "ServiceNames", newLanguages, new List <string>() { NameTypeEnum.Name.ToString() }); languages = new LanguageListValidator(model.Languages, codeService); serviceClasses = new ServiceClassListValidator(model.ServiceClasses, fintoService); ontologyTerms = new OntologyTermListValidator(model.OntologyTerms, fintoService); targetGroups = new TargetGroupListValidator(model.TargetGroups, fintoService); lifeEvents = new LifeEventListValidator(model.LifeEvents, fintoService); industrialClasses = new IndustrialClassListValidator(model.IndustrialClasses, fintoService); organizations = new OrganizationIdListValidator(model.OtherResponsibleOrganizations?.Select(o => o.ToString()).ToList(), commonService, "OtherResponsibleOrganizations"); status = new PublishingStatusValidator(model.PublishingStatus, model.CurrentPublishingStatus); areas = new AreaAndTypeValidator(model.Areas, model.AreaType, codeService); var channelList = model.ServiceServiceChannels?.Count > 0 ? model.ServiceServiceChannels.Select(i => i.ChannelGuid).ToList() : new List <Guid>(); channels = new ServiceChannelIdListValidator(channelList, channelService, userRole, "ServiceChannels"); var availableOrganizations = new List <Guid>(); if (!model.MainResponsibleOrganization.IsNullOrEmpty()) { availableOrganizations.Add(model.MainResponsibleOrganization.ParseToGuidWithExeption()); } if (model.OtherResponsibleOrganizations?.Count > 0) { availableOrganizations.AddRange(model.OtherResponsibleOrganizations); } serviceProducers = new ServiceProducerListValidator(model.ServiceProducers, availableOrganizations, commonService); mainOrganization = new OrganizationIdValidator(model.MainResponsibleOrganization, commonService, "MainResponsibleOrganization"); generalDescriptionAttached = !string.IsNullOrEmpty(model.StatutoryServiceGeneralDescriptionId); this.newLanguages = newLanguages; }
/// <summary> /// ServiceChannelController constructor. /// </summary> public V4ServiceChannelController( IChannelService channelService, IOrganizationService organizationService, ICodeService codeService, IServiceService serviceService, IOptions <AppSettings> settings, IFintoService fintoService, ILogger <V4ServiceChannelController> logger, ICommonService commonService, IUserOrganizationService userOrganizationService) : base(channelService, organizationService, codeService, serviceService, settings, logger, commonService, 4, userOrganizationService) { }
/// <summary> /// Initializes a new instance of the <see cref="V7ServiceController"/> class. /// </summary> /// <param name="serviceService">The service service.</param> /// <param name="commonService">The common service.</param> /// <param name="codeService">The code service.</param> /// <param name="settings">The settings.</param> /// <param name="generalDescriptionService">The general description service.</param> /// <param name="fintoService">The finto service.</param> /// <param name="serviceAndChannelService">The service and channel service.</param> /// <param name="channelService">The channel service.</param> /// <param name="userOrganizationService">The user organization service.</param> /// <param name="logger">The logger.</param> public V7ServiceController( IServiceService serviceService, ICommonService commonService, ICodeService codeService, IOptions <AppSettings> settings, IGeneralDescriptionService generalDescriptionService, IFintoService fintoService, IServiceAndChannelService serviceAndChannelService, IChannelService channelService, IUserOrganizationService userOrganizationService, ILogger <V7ServiceController> logger) : base(serviceService, commonService, codeService, settings, generalDescriptionService, fintoService, serviceAndChannelService, channelService, userOrganizationService, logger, 7) { }
/// <summary> /// Contructor /// </summary> /// <param name="generalDescriptionService"></param> /// <param name="codeService"></param> /// <param name="settings"></param> /// <param name="fintoService"></param> /// <param name="logger"></param> /// <param name="userOrganizationService"></param> /// <param name="versionNumber"></param> public GeneralDescriptionBaseController( IGeneralDescriptionService generalDescriptionService, ICodeService codeService, IOptions <AppSettings> settings, IFintoService fintoService, ILogger logger, IUserOrganizationService userOrganizationService, int versionNumber) : base(userOrganizationService, settings, logger) { this.generalDescriptionService = generalDescriptionService; pageSize = Settings.PageSize > 0 ? Settings.PageSize : 1000; this.versionNumber = versionNumber; this.codeService = codeService; this.fintoService = fintoService; }
/// <summary> /// Constructor of Common controller /// </summary> /// <param name="logger">logger commponent to support logging - injected by framework</param> /// <param name="addressService">address service responsible for operation related to addresses - injected by framework</param> /// <param name="serviceManager">manager responsible for wrapping of individual service call to UI output format - injected by framework</param> /// <param name="languageService">language service responsible for operation related to languages - injected by framework</param> /// <param name="commonService">common service responsible for operation related to common stuff - injected by framework</param> /// <param name="dialCodeService">dial code service responsible for operation related to dial codes - injected by framework</param> /// <param name="fintoService">finto service responsible for operation related to finto stuff - injected by framework</param> /// <param name="countryService">country service responsible for operation related to countries - injected by framework</param> /// <param name="userOrganizationService">user organization service - injected by framework</param> /// <param name="postalCodeService">postal code service responsible for operation related to postal codes - injected by framework</param> public RESTCommonController( ILogger <RESTCommonController> logger, IAddressService addressService, IServiceManager serviceManager, ILanguageService languageService, ICommonService commonService, IDialCodeService dialCodeService, IFintoService fintoService, ICountryService countryService, IUserOrganizationService userOrganizationService, IPostalCodeService postalCodeService) : base(logger) { this.addressService = addressService; this.serviceManager = serviceManager; this.languageService = languageService; this.commonService = commonService; this.fintoService = fintoService; this.dialCodeService = dialCodeService; this.countryService = countryService; this.userOrganizationService = userOrganizationService; this.postalCodeService = postalCodeService; }
public ValidatorTestBase() { codeServiceMockSetup = new Mock <ICodeService>(); codeService = codeServiceMockSetup.Object; commonServiceMockSetup = new Mock <ICommonService>(); commonService = commonServiceMockSetup.Object; generalDescriptionServiceMockSetup = new Mock <IGeneralDescriptionService>(); generalDescriptionService = generalDescriptionServiceMockSetup.Object; fintoServiceMockSetup = new Mock <IFintoService>(); fintoService = fintoServiceMockSetup.Object; channelServiceMockSetup = new Mock <IChannelService>(); channelService = channelServiceMockSetup.Object; serviceServiceMockSetup = new Mock <IServiceService>(); serviceService = serviceServiceMockSetup.Object; controller = new TestController(); }
public FintoItemValidatorTestBase() { fintoServiceMockSetup = new Mock <IFintoService>(); fintoService = fintoServiceMockSetup.Object; controller = new TestController(); }
/// <summary> /// Ctor - ontology term list validator. /// </summary> /// <param name="model">Ontology term list</param> /// <param name="fintoService">Finto item service</param> /// <param name="propertyName">Property name</param> public OntologyTermListValidator(IList <string> model, IFintoService fintoService, string propertyName = "OntologyTerms") : base(model, propertyName) { this.fintoService = fintoService; }
/// <summary> /// Ctor - life event list validator. /// </summary> /// <param name="model">life event list</param> /// <param name="fintoService">Finto item service</param> /// <param name="propertyName">Property name</param> public LifeEventListValidator(IList <string> model, IFintoService fintoService, string propertyName = "LifeEvents") : base(model, propertyName) { this.fintoService = fintoService; }
/// <summary> /// Ctor - general description validator /// </summary> /// <param name="model">General description model</param> /// <param name="codeService">Code service</param> /// <param name="fintoService">Finto item service</param> /// <param name="newLanguages">Languages that should be validated within lists</param> /// <param name="createOperation">Indicates if general description is beeing created or updated.</param> public GeneralDescriptionValidator(IVmOpenApiGeneralDescriptionInVersionBase model, ICodeService codeService, IFintoService fintoService, IList <string> newLanguages, bool createOperation) : base(model, "GeneralDescription") { if (model == null) { throw new ArgumentNullException(PropertyName, $"{PropertyName} must be defined."); } names = new LocalizedListValidator(model.Names, "Names", newLanguages, new List <string>() { NameTypeEnum.Name.ToString() }); languages = new LanguageListValidator(model.Languages, codeService); serviceClasses = new ServiceClassListValidator(model.ServiceClasses, fintoService); ontologyTerms = new OntologyTermListValidator(model.OntologyTerms, fintoService); targetGroups = new TargetGroupListValidator(model.TargetGroups, fintoService); lifeEvents = new LifeEventListValidator(model.LifeEvents, fintoService); industrialClasses = new IndustrialClassListValidator(model.IndustrialClasses, fintoService); status = new PublishingStatusValidator(model.PublishingStatus, model.CurrentPublishingStatus); this.createOperation = createOperation; this.newLanguages = newLanguages; }
/// <summary> /// Ctor - target group list validator. /// </summary> /// <param name="model">Target group list</param> /// <param name="fintoService">Finto item service</param> /// <param name="propertyName">Property name</param> public TargetGroupListValidator(IList <string> model, IFintoService fintoService, string propertyName = "TargetGroups") : base(model, propertyName) { this.fintoService = fintoService; }
/// <summary> /// Ctor - service class list validator. /// </summary> /// <param name="model">Service class list</param> /// <param name="fintoService">Finto item service</param> /// <param name="propertyName">Property name</param> public ServiceClassListValidator(IList <string> model, IFintoService fintoService, string propertyName = "ServiceClasses") : base(model, propertyName) { this.fintoService = fintoService; }