コード例 #1
0
        public ServiceDomainController(IServiceDomainService serviceDomainService,
                                       IServiceDeskService serviceDeskService,
                                       IDomainTypeRefDataService domainTypeRefDataService,
                                       IParameterService parameterService,
                                       ITemplateService templateService,
                                       IContextManager contextManager,
                                       IAppUserContext appUserContext)
        {
            if (serviceDomainService == null)
            {
                throw new ArgumentNullException(nameof(serviceDomainService));
            }

            if (serviceDeskService == null)
            {
                throw new ArgumentNullException(nameof(serviceDeskService));
            }

            if (domainTypeRefDataService == null)
            {
                throw new ArgumentNullException(nameof(domainTypeRefDataService));
            }

            if (parameterService == null)
            {
                throw new ArgumentNullException(nameof(parameterService));
            }

            if (templateService == null)
            {
                throw new ArgumentNullException(nameof(templateService));
            }

            if (contextManager == null)
            {
                throw new ArgumentNullException(nameof(contextManager));
            }

            if (appUserContext == null)
            {
                throw new ArgumentNullException(nameof(appUserContext));
            }

            _serviceDomainService     = serviceDomainService;
            _serviceDeskService       = serviceDeskService;
            _domainTypeRefDataService = domainTypeRefDataService;
            _parameterService         = parameterService;
            _templateService          = templateService;
            _contextManager           = contextManager;
            _appUserContext           = appUserContext;
        }
コード例 #2
0
        public TransformTemplateToDesign(IServiceDeskService serviceDeskService,
                                         IServiceDomainService serviceDomainService,
                                         IServiceFunctionService serviceFunctionService,
                                         IServiceComponentService serviceComponentService,
                                         IDomainTypeRefDataService domainTypeRefDataService,
                                         IFunctionTypeRefDataService functionTypeRefDataService,
                                         IServiceDeliveryOrganisationTypeRefDataService serviceDeliveryOrganisationTypeRefDataService,
                                         IServiceDeliveryUnitTypeRefDataService serviceDeliveryUnitTypeRefDataService,
                                         IResolverGroupTypeRefDataService resolverGroupTypeRefDataService,
                                         IUserIdentity userIdentity)
        {
            if (serviceDeskService == null)
            {
                throw new ArgumentNullException(nameof(serviceDeskService));
            }
            if (serviceDomainService == null)
            {
                throw new ArgumentNullException(nameof(serviceDomainService));
            }
            if (serviceFunctionService == null)
            {
                throw new ArgumentNullException(nameof(serviceFunctionService));
            }
            if (serviceComponentService == null)
            {
                throw new ArgumentNullException(nameof(serviceComponentService));
            }
            if (domainTypeRefDataService == null)
            {
                throw new ArgumentNullException(nameof(domainTypeRefDataService));
            }
            if (functionTypeRefDataService == null)
            {
                throw new ArgumentNullException(nameof(functionTypeRefDataService));
            }
            if (serviceDeliveryOrganisationTypeRefDataService == null)
            {
                throw new ArgumentNullException(nameof(serviceDeliveryOrganisationTypeRefDataService));
            }
            if (serviceDeliveryUnitTypeRefDataService == null)
            {
                throw new ArgumentNullException(nameof(serviceDeliveryUnitTypeRefDataService));
            }
            if (resolverGroupTypeRefDataService == null)
            {
                throw new ArgumentNullException(nameof(resolverGroupTypeRefDataService));
            }
            if (userIdentity == null)
            {
                throw new ArgumentNullException(nameof(userIdentity));
            }

            _serviceDeskService         = serviceDeskService;
            _serviceDomainService       = serviceDomainService;
            _serviceFunctionService     = serviceFunctionService;
            _serviceComponentService    = serviceComponentService;
            _domainTypeRefDataService   = domainTypeRefDataService;
            _functionTypeRefDataService = functionTypeRefDataService;
            _serviceDeliveryOrganisationTypeRefDataService = serviceDeliveryOrganisationTypeRefDataService;
            _serviceDeliveryUnitTypeRefDataService         = serviceDeliveryUnitTypeRefDataService;
            _resolverGroupTypeRefDataService = resolverGroupTypeRefDataService;
            _userIdentity = userIdentity;
        }
コード例 #3
0
        public void TestInitilize()
        {
            _domains = new List <DomainTypeRefData>
            {
                new DomainTypeRefData {
                    Id = 1, DomainName = "Domain A", SortOrder = 5, Visible = true
                },
                new DomainTypeRefData {
                    Id = 2, DomainName = "Domain B", SortOrder = 5, Visible = true
                },
                new DomainTypeRefData {
                    Id = 3, DomainName = "Domain C", SortOrder = 5, Visible = true
                },
                new DomainTypeRefData {
                    Id = 4, DomainName = "Domain D", SortOrder = 5, Visible = true
                },
                new DomainTypeRefData {
                    Id = 5, DomainName = "3663 Domain E", SortOrder = 5, Visible = false
                },
                new DomainTypeRefData {
                    Id = 6, DomainName = "Robeco Domain F", SortOrder = 5, Visible = false
                }
            };

            _serviceDomains = new List <ServiceDomain>
            {
                UnitTestHelper.GenerateRandomData <ServiceDomain>(x =>
                {
                    x.DomainType   = _domains.First(y => y.Id == 1);
                    x.DomainTypeId = 1;
                    x.ServiceDesk  = new ServiceDesk
                    {
                        Id         = 1,
                        CustomerId = CustomerId,
                        Customer   = UnitTestHelper.GenerateRandomData <Customer>(c =>
                        {
                            c.Id = CustomerId;
                            c.AssignedArchitect = UserNameTwo;
                            c.Contributors      = new List <Contributor>();
                        })
                    };
                }),
                UnitTestHelper.GenerateRandomData <ServiceDomain>(x =>
                {
                    x.DomainType   = _domains.First(y => y.Id == 2);
                    x.DomainTypeId = 2;
                    x.ServiceDesk  = new ServiceDesk
                    {
                        Id         = 2,
                        CustomerId = 2,
                        Customer   = UnitTestHelper.GenerateRandomData <Customer>(c =>
                        {
                            c.Id = 2;
                            c.AssignedArchitect = UserNameTwo;
                            c.Contributors      = new List <Contributor>();
                        })
                    };
                }),
                UnitTestHelper.GenerateRandomData <ServiceDomain>(x =>
                {
                    x.DomainType   = _domains.First(y => y.Id == 5);
                    x.DomainTypeId = 5;
                    x.ServiceDesk  = new ServiceDesk
                    {
                        Id         = 3,
                        CustomerId = 3,
                        Customer   = UnitTestHelper.GenerateRandomData <Customer>(c =>
                        {
                            c.Id = 3;
                            c.AssignedArchitect = UserNameOne;
                            c.Contributors      = new List <Contributor>
                            {
                                new Contributor
                                {
                                    Id           = 1,
                                    CustomerId   = 3,
                                    EmailAddress = UserNameThree
                                }
                            };
                        })
                    };
                }),
                UnitTestHelper.GenerateRandomData <ServiceDomain>(x =>
                {
                    x.DomainType   = _domains.First(y => y.Id == 1);
                    x.DomainTypeId = 1;
                    x.ServiceDesk  = new ServiceDesk
                    {
                        Id         = 4,
                        CustomerId = 4,
                        Customer   = UnitTestHelper.GenerateRandomData <Customer>(c =>
                        {
                            c.Id = 4;
                            c.AssignedArchitect = UserNameTwo;
                            c.Contributors      = new List <Contributor>();
                        })
                    };
                })
            };

            _serviceDesks = new List <ServiceDesk>
            {
                new ServiceDesk
                {
                    CustomerId     = CustomerId,
                    ServiceDomains = new List <ServiceDomain>
                    {
                        UnitTestHelper.GenerateRandomData <ServiceDomain>(x =>
                        {
                            x.DomainType   = _domains.First(y => y.Id == 1);
                            x.DomainTypeId = 1;
                        }),
                        UnitTestHelper.GenerateRandomData <ServiceDomain>(x =>
                        {
                            x.DomainType = _domains.First(y => y.Id == 2);
                        }),
                        UnitTestHelper.GenerateRandomData <ServiceDomain>(x =>
                        {
                            x.DomainType = _domains.First(y => y.Id == 5);
                        })
                    }
                },
                new ServiceDesk
                {
                    Customer       = UnitTestHelper.GenerateRandomData <Customer>(),
                    ServiceDomains = new List <ServiceDomain>
                    {
                        UnitTestHelper.GenerateRandomData <ServiceDomain>(x =>
                        {
                            x.DomainType   = _domains.First(y => y.Id == 1);
                            x.DomainTypeId = 1;
                        }),
                        UnitTestHelper.GenerateRandomData <ServiceDomain>(x =>
                        {
                            x.DomainType = _domains.First(y => y.Id == 2);
                        }),
                        UnitTestHelper.GenerateRandomData <ServiceDomain>(x =>
                        {
                            x.DomainType = _domains.First(y => y.Id == 6);
                        })
                    }
                }
            };

            _mockServiceDeskRepository = MockRepositoryHelper.Create(_serviceDesks);

            _mockUnitOfWork = new Mock <IUnitOfWork>();

            _mockDomainTypeRefDataRepository = MockRepositoryHelper.Create(_domains);

            _mockServiceDomainRepository = MockRepositoryHelper.Create(_serviceDomains);

            _mockParameterService = new Mock <IParameterService>();

            _domainTypeRefDataService = new DomainTypeRefDataService(_mockDomainTypeRefDataRepository.Object,
                                                                     _mockServiceDeskRepository.Object,
                                                                     _mockServiceDomainRepository.Object,
                                                                     _mockParameterService.Object,
                                                                     _mockUnitOfWork.Object);

            Bootstrapper.SetupAutoMapper();
        }