public ApplicationsService(IService <Application, int> apps, ISecurityService security, IService <ApplicationAuthentication, int> auth, IService <ApplicationToken, int> tokens, IService <DataSchema, int> schemas, IService <SchemaFile, int> schemaFiles, IService <OrganizationLicense, int> licenses, IService <ProviderEndpoint, int> endpoints, IService <LicenseTemplate, int> licenseTemplates, INotificationService notifications, ILicenseMatchesService matches, IService <Organization, int> orgs, IService <ConsumerProviderRegistration, int> consumerProviderRegistrations) { _applications = apps; _organisations = orgs; _authentications = auth; _tokens = tokens; _schemas = schemas; _schemaFiles = schemaFiles; _licenses = licenses; _endpoints = endpoints; _security = security; _notifications = notifications; _licenseTemplates = licenseTemplates; _licenseMatches = matches; _consumerProviderRegistrations = consumerProviderRegistrations; }
public OrganizationLicenseService(IService <OrganizationLicense, int> service, ILicenseMatchesService matchesService, IService <DataSchema, int> schemaService, IService <Application, int> applicationService, IService <LicenseClauseTemplate, int> clauseTemplates, IService <LicenseSection, int> sections, IService <LicenseClause, int> clauses, IService <ProviderEndpoint, int> endpoints, IService <OrganizationLicenseClause, int> orgLicenseClauseService, IService <SchemaFile, int> schemaFile, IService <Organization, int> organisations, IService <LicenseTemplate, int> licenseTemplates, ISecurityService security, IOrganizationLicenseClauseService licenseClauses, IConfigurationService config, ILicenseContentBuilder licenseContentBuilder, INotificationService notifications, IService <CustomLicense, int> customLicenses, IService <LicenseApprovalRequest, int> verificationRequests, ITokenService tokens, IService <User, int> users, IService <LicenseAgreement, int> agreements, IUrlProvider urls, IConfigurationService configuration) { _service = service; _licenseMatches = matchesService; _dataSchemaService = schemaService; _applicationService = applicationService; _clauseTemplateService = clauseTemplates; _sectionService = sections; _clauseService = clauses; _licenseClauseService = orgLicenseClauseService; _schemaFileService = schemaFile; _licenseClauses = licenseClauses; _security = security; _endpoints = endpoints; _organisations = organisations; _licenseTemplates = licenseTemplates; _licenseContentBuilder = licenseContentBuilder; _customLicenses = customLicenses; _config = config; _tokens = tokens; _verificationRequests = verificationRequests; _users = users; _agreements = agreements; _notificationService = notifications; _urls = urls; }
public DataSchemaService(IService <SchemaFile, int> schemaFiles, ILicenseMatchesService licenseMatches, IService <OrganizationLicense, int> licenses, IService <Application, int> apps, IService <Organization, int> orgs, IService <ProviderEndpoint, int> providerEndpoints, IService <User, int> users, IOrganizationLicenseService orgLicenses, INotificationService notifications, IService <DataSchema, int> schemas) { _schemas = schemas; _schemaFiles = schemaFiles; _licenseMatches = licenseMatches; _licenses = licenses; _applications = apps; _organisations = orgs; _providerEndpoints = providerEndpoints; _users = users; _notifications = notifications; _orgLicenses = orgLicenses; }
public void Init() { schema = new DataSchema { PublicID = validSchema, Status = (int)TemplateStatus.Active, ID = 1 }; organization = new Organization { ID = 1, Name = "Org", IsActive = true }; providerApplication = new Application { PublicID = Guid.Parse("E86FA7A0-04EB-4B68-821E-7E221FEC4368"), ID = 1, Name = "application", IsProvider = true, OrganizationID = organization.ID }; consumerApplication = new Application { PublicID = Guid.Parse("b95c549e-d711-4597-89e0-fdc33d1d17ca"), ID = 2, Name = "application", IsProvider = false, OrganizationID = organization.ID }; organizationLicense = new OrganizationLicense { ApplicationID = providerApplication.ID, ID = 1, Status = (int)PublishStatus.Published, LicenseTemplateID = 1, ProviderEndpointID = 1, DataSchemaID = schema.ID }; _organizationService = new Mock <IOrganizationService>(); _applicationService = new Mock <IApplicationsService>(); _orgLicenseService = new Mock <IOrganizationLicenseService>(); _dataSchemaService = new Mock <IDataSchemaService>(); _agreementService = new Mock <ILicenseAgreementService>(); _notificationService = new Mock <INotificationService>(); _schemaFileService = new Mock <ISchemaFileService>(); _softwareStatementService = new Mock <ISoftwareStatementService>(); _legalOfficerNotificationService = new Mock <ILegalOfficerNotificationService>(); //Setup notification service _notificationService.SetupGet(i => i.LegalOfficer).Returns(_legalOfficerNotificationService.Object); // Setup Matches service mService = new MockService <LicenseMatch>(); matchesService = new LicenseMatchesService(mService); mService.Add(new LicenseMatch { ConsumerLicenseID = organizationLicense.ID }); mService.Add(new LicenseMatch { ProviderLicenseID = organizationLicense.ID, ConsumerLicenseID = organizationLicense.ID }); // Setup license service _orgLicenseService.Setup(i => i.GetForApplicationAndSchema(providerApplication.ID, schema.ID, true)) .Returns(new List <OrganizationLicense> { organizationLicense }); _orgLicenseService.Setup(i => i.GetForApplicationAndSchema(consumerApplication.ID, schema.ID, true)) .Returns(new List <OrganizationLicense> { organizationLicense }); _orgLicenseService.Setup(i => i.GetForApplicationAndSchema(0, schema.ID, true)).Returns(new List <OrganizationLicense>()); // Setup schemaFile _schemaFileService.Setup(i => i.Get(It.IsAny <Expression <Func <SchemaFile, bool> > >())) .Returns(new List <SchemaFile> { new SchemaFile() }); // Setup license agreement _agreementService.Setup(i => i.Add(It.IsAny <LicenseAgreement>())).Returns(true); // Setup application service _applicationService.Setup(i => i.Get(providerApplication.ID)).Returns(providerApplication); _applicationService.Setup(i => i.Get(consumerApplication.ID)).Returns(consumerApplication); _applicationService.Setup(i => i.Get(It.IsAny <Expression <Func <Application, bool> > >())) .Returns(new List <Application> { consumerApplication }); // Setup data schema service _dataSchemaService.Setup(i => i.Get(validSchema)).Returns(schema); // Setup Statement _softwareStatementService.SetupGet(i => i.TokenValidationParameters).Returns(TokenValidationParameters); context = new Mock <HttpRequestMessage>(); _controller = new LicenseAgreementsController(_organizationService.Object, _applicationService.Object, _orgLicenseService.Object, _dataSchemaService.Object, _agreementService.Object, _notificationService.Object, _schemaFileService.Object, _softwareStatementService.Object, matchesService) { Request = context.Object, LoggedInApp = new LoggedInApplication(providerApplication) { TokenUsedToAuthorize = applicationToken, Organization = new LoggedInOrganization(organization) } }; _controller.Request.Properties.Add(HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration()); }