Esempio n. 1
0
        public CustomerServiceOrganisation(IServiceDeskService serviceDeskService, IServiceComponentService serviceComponentService)
        {
            if (serviceDeskService == null)
            {
                throw new ArgumentNullException(nameof(serviceDeskService));
            }

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

            _serviceDeskService             = serviceDeskService;
            _serviceComponentService        = serviceComponentService;
            _serviceOrganisationDiagramtype = ServiceDeliveryOrganisationNames.Customer;
        }
 protected BaseServiceComponentController(IContextManager contextManager,
                                          IServiceComponentService serviceComponentService,
                                          IServiceFunctionService serviceFunctionService,
                                          IServiceDeliveryOrganisationTypeRefDataService serviceDeliveryOrganisationTypeRefDataService,
                                          IServiceDeliveryUnitTypeRefDataService serviceDeliveryUnitTypeRefDataService,
                                          IResolverGroupTypeRefDataService resolverGroupTypeRefDataService,
                                          IParameterService parameterService,
                                          IAppUserContext appUserContext,
                                          IServiceComponentHelper serviceComponentHelper)
     : base(contextManager)
 {
     _contextManager          = contextManager;
     _serviceComponentService = serviceComponentService;
     _serviceFunctionService  = serviceFunctionService;
     _serviceDeliveryOrganisationTypeRefDataService = serviceDeliveryOrganisationTypeRefDataService;
     _serviceDeliveryUnitTypeRefDataService         = serviceDeliveryUnitTypeRefDataService;
     _resolverGroupTypeRefDataService = resolverGroupTypeRefDataService;
     _parameterService       = parameterService;
     _appUserContext         = appUserContext;
     _serviceComponentHelper = serviceComponentHelper;
 }
Esempio n. 3
0
        public void TestInitilize()
        {
            #region Desk Input Types

            _deskInputTypes = new List <DeskInputType>
            {
                new DeskInputType
                {
                    Id = 1,
                    InputTypeRefData =
                        new InputTypeRefData {
                        Id = 1, InputTypeNumber = 1, InputTypeName = "Incident", SortOrder = 5
                    }
                },
                new DeskInputType
                {
                    Id = 2,
                    InputTypeRefData =
                        new InputTypeRefData {
                        Id = 2, InputTypeNumber = 2, InputTypeName = "Event", SortOrder = 5
                    }
                },
                new DeskInputType
                {
                    Id = 3,
                    InputTypeRefData =
                        new InputTypeRefData
                    {
                        Id = 3,
                        InputTypeNumber = 3,
                        InputTypeName   = "Authorized Request",
                        SortOrder       = 5
                    }
                },
                new DeskInputType
                {
                    Id = 4,
                    InputTypeRefData =
                        new InputTypeRefData
                    {
                        Id = 4,
                        InputTypeNumber = 4,
                        InputTypeName   = "How do I.. Questions",
                        SortOrder       = 5
                    }
                },
                new DeskInputType
                {
                    Id = 5,
                    InputTypeRefData =
                        new InputTypeRefData
                    {
                        Id = 5,
                        InputTypeNumber = 5,
                        InputTypeName   = "Authorized Standard Change",
                        SortOrder       = 5
                    }
                },
                new DeskInputType
                {
                    Id = 6,
                    InputTypeRefData =
                        new InputTypeRefData
                    {
                        Id = 6,
                        InputTypeNumber = 6,
                        InputTypeName   = "Authorized Non-Standard Change",
                        SortOrder       = 5
                    }
                }
            };

            #endregion

            #region Service Domain Types

            _serviceDomainTypes = new List <DomainTypeRefData>
            {
                new DomainTypeRefData {
                    Id = 1, DomainName = "Service Desk", SortOrder = 5, Visible = true
                },
                new DomainTypeRefData {
                    Id = 2, DomainName = "Infrastructure as a Service", SortOrder = 5, Visible = true
                },
                new DomainTypeRefData {
                    Id = 3, DomainName = "Service Delivery Management", SortOrder = 5, Visible = true
                },
                new DomainTypeRefData {
                    Id = 4, DomainName = "Infrastructure Management", SortOrder = 5, Visible = true
                },
                new DomainTypeRefData {
                    Id = 5, DomainName = "End User Device Services", SortOrder = 5, Visible = true
                },
                new DomainTypeRefData {
                    Id = 6, DomainName = "Engineering Services", SortOrder = 5, Visible = true
                },
                new DomainTypeRefData {
                    Id = 7, DomainName = "Programme Management Office", SortOrder = 5, Visible = true
                },
                new DomainTypeRefData {
                    Id = 8, DomainName = "Consulting Services", SortOrder = 5, Visible = true
                },
                new DomainTypeRefData {
                    Id = 9, DomainName = "Bill of material components", SortOrder = 5, Visible = true
                }
            };

            #endregion

            #region Service Function Types

            _serviceFunctionTypes = new List <FunctionTypeRefData>
            {
                new FunctionTypeRefData {
                    Id = 1, FunctionName = "System Management Infrastructure", SortOrder = 5, Visible = true
                },
                new FunctionTypeRefData {
                    Id = 2, FunctionName = "Desktop Virtualisation", SortOrder = 5, Visible = true
                },
                new FunctionTypeRefData {
                    Id = 3, FunctionName = "Secure Remote Access", SortOrder = 5, Visible = true
                },
                new FunctionTypeRefData {
                    Id = 4, FunctionName = "Computing Management", SortOrder = 5, Visible = true
                },
                new FunctionTypeRefData {
                    Id = 5, FunctionName = "General Services", SortOrder = 5, Visible = true
                },
                new FunctionTypeRefData {
                    Id = 6, FunctionName = "Network Services Tower A", SortOrder = 5, Visible = true
                },
                new FunctionTypeRefData {
                    Id = 7, FunctionName = "Network Services Tower B", SortOrder = 5, Visible = true
                }
            };

            #endregion

            #region Service Delivery Organisation Types

            _serviceDeliveryOrganisationTypes = new List <ServiceDeliveryOrganisationTypeRefData>
            {
                new ServiceDeliveryOrganisationTypeRefData
                {
                    Id = 1,
                    ServiceDeliveryOrganisationTypeName = "Fujitsu",
                    SortOrder = 5
                },
                new ServiceDeliveryOrganisationTypeRefData
                {
                    Id = 2,
                    ServiceDeliveryOrganisationTypeName = "Customer",
                    SortOrder = 5
                },
                new ServiceDeliveryOrganisationTypeRefData
                {
                    Id = 3,
                    ServiceDeliveryOrganisationTypeName = "Customer Third Party",
                    SortOrder = 5
                },
            };

            #endregion

            #region Service Delivery Unit Types

            _serviceDeliveryUnitTypes = new List <ServiceDeliveryUnitTypeRefData>
            {
                new ServiceDeliveryUnitTypeRefData
                {
                    Id = 1,
                    ServiceDeliveryUnitTypeName = "Verizon",
                    SortOrder = 5
                },
                new ServiceDeliveryUnitTypeRefData
                {
                    Id = 2,
                    ServiceDeliveryUnitTypeName = "HP",
                    SortOrder = 5
                },
                new ServiceDeliveryUnitTypeRefData
                {
                    Id = 3,
                    ServiceDeliveryUnitTypeName = "Cisco",
                    SortOrder = 5
                },
                new ServiceDeliveryUnitTypeRefData
                {
                    Id = 4,
                    ServiceDeliveryUnitTypeName = "SAP",
                    SortOrder = 5
                },
                new ServiceDeliveryUnitTypeRefData
                {
                    Id = 5,
                    ServiceDeliveryUnitTypeName = "Business Apps",
                    SortOrder = 5
                },
                new ServiceDeliveryUnitTypeRefData
                {
                    Id = 6,
                    ServiceDeliveryUnitTypeName = "Facilities",
                    SortOrder = 5
                },
                new ServiceDeliveryUnitTypeRefData
                {
                    Id = 7,
                    ServiceDeliveryUnitTypeName = "Oracle",
                    SortOrder = 5
                },
            };

            #endregion

            #region Resolver Groups

            _resolverGroupTypes = new List <ResolverGroupTypeRefData>
            {
                new ResolverGroupTypeRefData {
                    Id = 1, ResolverGroupTypeName = "Wintel Team", SortOrder = 5
                },
                new ResolverGroupTypeRefData {
                    Id = 2, ResolverGroupTypeName = "Oracle Team", SortOrder = 10
                },
                new ResolverGroupTypeRefData {
                    Id = 3, ResolverGroupTypeName = "On-Site Support Dispatch", SortOrder = 15
                },
                new ResolverGroupTypeRefData {
                    Id = 4, ResolverGroupTypeName = "On-Site Support Permanent", SortOrder = 15
                },
                new ResolverGroupTypeRefData {
                    Id = 5, ResolverGroupTypeName = "Off-Site Support Dispatch", SortOrder = 15
                },
                new ResolverGroupTypeRefData {
                    Id = 6, ResolverGroupTypeName = "Off-Site Support Permanent", SortOrder = 15
                },
            };

            #endregion

            #region Service Desks

            _serviceDesks = new List <ServiceDesk>
            {
                new ServiceDesk
                {
                    Id         = 1,
                    DeskName   = "Service Desk A With Inputs",
                    CustomerId = 1,
                    Customer   = UnitTestHelper.GenerateRandomData <Customer>(c =>
                    {
                        c.Id           = 1;
                        c.CustomerName = "3663";
                    }),
                    DeskInputTypes = new List <DeskInputType>
                    {
                        _deskInputTypes.FirstOrDefault(x => x.Id == 1),
                        _deskInputTypes.FirstOrDefault(x => x.Id == 2),
                        _deskInputTypes.FirstOrDefault(x => x.Id == 3),
                        _deskInputTypes.FirstOrDefault(x => x.Id == 4),
                        _deskInputTypes.FirstOrDefault(x => x.Id == 5),
                        _deskInputTypes.FirstOrDefault(x => x.Id == 6)
                    },
                    ServiceDomains = new List <ServiceDomain>()
                },
                new ServiceDesk
                {
                    Id         = 2,
                    DeskName   = "Service Desk B With Domains",
                    CustomerId = 2,
                    Customer   = UnitTestHelper.GenerateRandomData <Customer>(c =>
                    {
                        c.Id           = 2;
                        c.CustomerName = "Robeco";
                    }),
                    ServiceDomains = new List <ServiceDomain>
                    {
                        new ServiceDomain
                        {
                            Id = 1,
                            AlternativeName  = "Domain A",
                            DomainType       = _serviceDomainTypes.FirstOrDefault(x => x.Id == 1),
                            ServiceFunctions = new List <ServiceFunction>
                            {
                                new ServiceFunction
                                {
                                    Id = 1,
                                    AlternativeName = "Function A",
                                    FunctionType    = _serviceFunctionTypes.FirstOrDefault(x => x.Id == 1),
                                },
                                new ServiceFunction
                                {
                                    Id = 2,
                                    AlternativeName = "Function B",
                                    FunctionType    = _serviceFunctionTypes.FirstOrDefault(x => x.Id == 2)
                                }
                            }
                        },
                        new ServiceDomain
                        {
                            Id               = 2,
                            DomainType       = _serviceDomainTypes.FirstOrDefault(x => x.Id == 2),
                            ServiceFunctions = new List <ServiceFunction>
                            {
                                new ServiceFunction
                                {
                                    Id = 3,
                                    AlternativeName = "Function C",
                                    FunctionType    = _serviceFunctionTypes.FirstOrDefault(x => x.Id == 3),
                                },
                                new ServiceFunction
                                {
                                    Id = 2,
                                    AlternativeName = "Function D",
                                    FunctionType    = _serviceFunctionTypes.FirstOrDefault(x => x.Id == 4)
                                }
                            }
                        },
                        new ServiceDomain
                        {
                            Id         = 3,
                            DomainType = new DomainTypeRefData
                            {
                                Id         = 3,
                                DomainName = "Domain C",
                                SortOrder  = 5,
                                Visible    = true,
                            }
                        }
                    }
                }
            };

            #endregion

            #region Service Components

            _serviceComponents = new List <ServiceComponent>
            {
                new ServiceComponent
                {
                    Id                = 1,
                    ComponentLevel    = 1,
                    ComponentName     = "Component A",
                    ServiceActivities = "- Activity One\r\n- Activity Two",
                    ServiceFunction   = CreateServiceFunctionWithCustomer(2, "Robeco", 2),
                    Resolver          = new Resolver
                    {
                        Id = 1,
                        ServiceDeliveryOrganisationType =
                            _serviceDeliveryOrganisationTypes.FirstOrDefault(x => x.Id == 1),
                        ServiceDeliveryUnitType = _serviceDeliveryUnitTypes.FirstOrDefault(x => x.Id == 1),
                        ResolverGroupType       = _resolverGroupTypes.FirstOrDefault(x => x.Id == 1),
                    }
                },
                new ServiceComponent
                {
                    Id              = 2,
                    ComponentLevel  = 1,
                    ComponentName   = "Component B",
                    ServiceFunction = CreateServiceFunctionWithCustomer(2, "Robeco", 2),
                }
            };

            _serviceComponents.Add(
                new ServiceComponent
            {
                Id                     = 3,
                ComponentLevel         = 2,
                ComponentName          = "Component C",
                ServiceActivities      = "- Activity Three",
                ServiceFunction        = CreateServiceFunctionWithCustomer(2, "Robeco", 2),
                ParentServiceComponent = _serviceComponents[1],
                Resolver               = new Resolver
                {
                    Id = 2,
                    ServiceDeliveryOrganisationType =
                        _serviceDeliveryOrganisationTypes.FirstOrDefault(x => x.Id == 1),
                    ServiceDeliveryUnitType = _serviceDeliveryUnitTypes.FirstOrDefault(x => x.Id == 1),
                    ResolverGroupType       = _resolverGroupTypes.FirstOrDefault(x => x.Id == 1)
                }
            });

            _serviceComponents.Add(new ServiceComponent
            {
                Id                     = 4,
                ComponentLevel         = 2,
                ComponentName          = "Component D",
                ServiceFunction        = CreateServiceFunctionWithCustomer(2, "Robeco", 2),
                ParentServiceComponent = _serviceComponents[1],
                Resolver               = new Resolver
                {
                    Id = 3,
                    ServiceDeliveryOrganisationType = _serviceDeliveryOrganisationTypes.FirstOrDefault(x => x.Id == 1),
                    ServiceDeliveryUnitType         = _serviceDeliveryUnitTypes.FirstOrDefault(x => x.Id == 2),
                    ResolverGroupType = _resolverGroupTypes.FirstOrDefault(x => x.Id == 3),
                }
            });

            _serviceComponents[1].ChildServiceComponents = new List <ServiceComponent>
            {
                _serviceComponents[2],
                _serviceComponents[3]
            };

            _serviceComponents.Add(new ServiceComponent
            {
                Id                = 5,
                ComponentLevel    = 1,
                ComponentName     = "Component E",
                ServiceActivities = "- Activity X\r\n- Activity Y",
                ServiceFunction   = CreateServiceFunctionWithCustomer(2, "Robeco", 2),
                Resolver          = new Resolver
                {
                    Id = 4,
                    ServiceDeliveryOrganisationType = _serviceDeliveryOrganisationTypes.FirstOrDefault(x => x.Id == 3),
                    ServiceDeliveryUnitType         = _serviceDeliveryUnitTypes.FirstOrDefault(x => x.Id == 2),
                    ResolverGroupType = _resolverGroupTypes.FirstOrDefault(x => x.Id == 4)
                }
            });

            _serviceComponents.Add(new ServiceComponent
            {
                Id              = 6,
                ComponentLevel  = 1,
                ComponentName   = "Component E",
                ServiceFunction = CreateServiceFunctionWithCustomer(2, "Robeco", 2),
            });

            _serviceComponents.Add(new ServiceComponent
            {
                Id                     = 7,
                ComponentLevel         = 2,
                ComponentName          = "Component F",
                ServiceActivities      = "- Activity X",
                ServiceFunction        = CreateServiceFunctionWithCustomer(2, "Robeco", 2),
                ParentServiceComponent = _serviceComponents[5],
                Resolver               = new Resolver
                {
                    Id = 5,
                    ServiceDeliveryOrganisationType = _serviceDeliveryOrganisationTypes.FirstOrDefault(x => x.Id == 1),
                    ServiceDeliveryUnitType         = _serviceDeliveryUnitTypes.FirstOrDefault(x => x.Id == 2),
                    ResolverGroupType = _resolverGroupTypes.FirstOrDefault(x => x.Id == 3),
                }
            });

            _serviceComponents.Add(new ServiceComponent
            {
                Id                     = 8,
                ComponentLevel         = 2,
                ComponentName          = "Component G",
                ServiceActivities      = "- Activity Z",
                ServiceFunction        = CreateServiceFunctionWithCustomer(2, "Robeco", 2),
                ParentServiceComponent = _serviceComponents[5],
                Resolver               = new Resolver
                {
                    Id = 6,
                    ServiceDeliveryOrganisationType = _serviceDeliveryOrganisationTypes.FirstOrDefault(x => x.Id == 2),
                    ServiceDeliveryUnitType         = _serviceDeliveryUnitTypes.FirstOrDefault(x => x.Id == 2),
                    ResolverGroupType = _resolverGroupTypes.FirstOrDefault(x => x.Id == 4)
                }
            });

            _serviceComponents.Add(new ServiceComponent
            {
                Id                     = 9,
                ComponentLevel         = 2,
                ComponentName          = "Component H",
                ServiceActivities      = "- Activity A",
                ServiceFunction        = CreateServiceFunctionWithCustomer(2, "Robeco", 2),
                ParentServiceComponent = _serviceComponents[5],
                Resolver               = new Resolver
                {
                    Id = 7,
                    ServiceDeliveryOrganisationType = _serviceDeliveryOrganisationTypes.FirstOrDefault(x => x.Id == 1),
                    ServiceDeliveryUnitType         = _serviceDeliveryUnitTypes.FirstOrDefault(x => x.Id == 2),
                    ResolverGroupType = _resolverGroupTypes.FirstOrDefault(x => x.Id == 3)
                }
            });

            _serviceComponents[5].ChildServiceComponents = new List <ServiceComponent>
            {
                _serviceComponents[6],
                _serviceComponents[7],
                _serviceComponents[8]
            };

            #endregion

            _resolvers = new List <Resolver>();

            _mockUnitOfWork = new Mock <IUnitOfWork>();

            _mockServiceDeskRepository      = MockRepositoryHelper.Create(_serviceDesks, (entity, id) => entity.Id == (int)id);
            _mockDeskInputTypeRepository    = MockRepositoryHelper.Create(_deskInputTypes, (entity, id) => entity.Id == (int)id);
            _mockResolverRepository         = MockRepositoryHelper.Create(_resolvers);
            _mockServiceComponentRepository = MockRepositoryHelper.Create(_serviceComponents, (entity, id) => entity.Id == (int)id);
            _mockUserIdentity = new Mock <IUserIdentity>();
            _mockUserIdentity.Setup(s => s.Name).Returns("*****@*****.**");

            _serviceDeskService      = new ServiceDeskService(_mockServiceDeskRepository.Object, _mockDeskInputTypeRepository.Object, _mockUnitOfWork.Object);
            _serviceComponentService = new ServiceComponentService(_mockServiceComponentRepository.Object, _mockResolverRepository.Object, _mockUnitOfWork.Object, _mockUserIdentity.Object);

            _diagramGenerator = new FujitsuServiceOrganisation(_serviceDeskService, _serviceComponentService);

            Bootstrapper.SetupAutoMapper();
        }
        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;
        }
Esempio n. 5
0
        public ServiceComponentController(IContextManager contextManager,
                                          IAppUserContext appUserContext,
                                          IServiceComponentService serviceComponentService,
                                          IServiceFunctionService serviceFunctionService,
                                          IServiceDeliveryOrganisationTypeRefDataService serviceDeliveryOrganisationTypeRefDataService,
                                          IServiceDeliveryUnitTypeRefDataService serviceDeliveryUnitTypeRefDataService,
                                          IResolverGroupTypeRefDataService resolverGroupTypeRefDataService,
                                          IParameterService parameterService,
                                          IServiceComponentHelper serviceComponentHelper) : base(contextManager,
                                                                                                 serviceComponentService,
                                                                                                 serviceFunctionService,
                                                                                                 serviceDeliveryOrganisationTypeRefDataService,
                                                                                                 serviceDeliveryUnitTypeRefDataService,
                                                                                                 resolverGroupTypeRefDataService,
                                                                                                 parameterService,
                                                                                                 appUserContext,
                                                                                                 serviceComponentHelper)
        {
            if (contextManager == null)
            {
                throw new ArgumentNullException(nameof(contextManager));
            }

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

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

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

            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 (parameterService == null)
            {
                throw new ArgumentNullException(nameof(parameterService));
            }

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

            _contextManager          = contextManager;
            _appUserContext          = appUserContext;
            _serviceComponentService = serviceComponentService;
            _serviceFunctionService  = serviceFunctionService;
            _serviceDeliveryOrganisationTypeRefDataService = serviceDeliveryOrganisationTypeRefDataService;
            _serviceDeliveryUnitTypeRefDataService         = serviceDeliveryUnitTypeRefDataService;
            _resolverGroupTypeRefDataService = resolverGroupTypeRefDataService;
            _parameterService       = parameterService;
            _serviceComponentHelper = serviceComponentHelper;
        }
        public void Initialize()
        {
            //TODO: Exception Logging Handler exception during tests needs further investigation
            //Bootstrapper.SetupAutoMapper();
            //var ob = new ObjectBuilder();
            //UnityConfig.RegisterTypes(ob.GetContainer(), () => new PerResolveLifetimeManager());
            //Logger.Reset();
            //Logger.SetLogWriter(new LogWriterFactory().Create());
            //var config = ConfigurationSourceFactory.Create();
            //var factory = new ExceptionPolicyFactory(config);
            //var exceptionManager = factory.CreateManager();
            //ExceptionPolicy.Reset();
            //ExceptionPolicy.SetExceptionManager(exceptionManager);

            #region Lists

            _serviceComponentMoveResolverSource = UnitTestHelper.GenerateRandomData <ServiceComponent>(x =>
            {
                x.ServiceFunction = CreateServiceFunctionWithCustomer(CustomerIdMoveResolver);
            });
            _serviceComponentMoveResolverDestination = UnitTestHelper.GenerateRandomData <ServiceComponent>(x =>
            {
                x.ServiceFunction = CreateServiceFunctionWithCustomer(CustomerIdMoveResolver);
            });
            _serviceComponentMoveResolverDestinationWithDependencies = UnitTestHelper.GenerateRandomData <ServiceComponent>(x =>
            {
                x.ServiceFunction = CreateServiceFunctionWithCustomer(CustomerIdMoveResolver);
                CreateResolver(x);
            });

            _resolvers = new List <Resolver>
            {
                UnitTestHelper.GenerateRandomData <Resolver>(x =>
                {
                    x.Id = 55;
                    x.OperationalProcessTypes = new List <OperationalProcessType>
                    {
                        UnitTestHelper.GenerateRandomData <OperationalProcessType>(y =>
                        {
                            y.Resolver = x;
                            y.OperationalProcessTypeRefData = UnitTestHelper.GenerateRandomData <OperationalProcessTypeRefData>();
                        }),
                        UnitTestHelper.GenerateRandomData <OperationalProcessType>(y =>
                        {
                            y.Resolver = x;
                            y.OperationalProcessTypeRefData = UnitTestHelper.GenerateRandomData <OperationalProcessTypeRefData>();
                        })
                    };
                })
            };

            _serviceComponentMoveResolverSource = UnitTestHelper.GenerateRandomData <ServiceComponent>(x =>
            {
                x.ServiceFunction = CreateServiceFunctionWithCustomer(CustomerIdMoveResolver);
                x.Resolver        = _resolvers[0];
            });

            _serviceComponents = new List <ServiceComponent>
            {
                UnitTestHelper.GenerateRandomData <ServiceComponent>(x =>
                {
                    x.ServiceFunction = CreateServiceFunctionWithCustomer(CustomerId);
                    CreateResolver(x);
                }),
                UnitTestHelper.GenerateRandomData <ServiceComponent>(x =>
                {
                    x.ServiceFunction = CreateServiceFunctionWithCustomer(56);
                    CreateResolver(x);
                }),
                UnitTestHelper.GenerateRandomData <ServiceComponent>(x =>
                {
                    x.Id = ServiceComponentId;
                    x.ServiceFunction = CreateServiceFunctionWithCustomer(CustomerId);
                    CreateResolver(x);
                }),
                UnitTestHelper.GenerateRandomData <ServiceComponent>(x =>
                {
                    x.ServiceFunction = CreateServiceFunctionWithCustomer(56);
                    CreateResolver(x);
                }),
                UnitTestHelper.GenerateRandomData <ServiceComponent>(x =>
                {
                    x.ServiceFunction = CreateServiceFunctionWithCustomer(56);
                    CreateResolver(x);
                }),

                UnitTestHelper.GenerateRandomData <ServiceComponent>(a =>
                {
                    a.ServiceFunction = UnitTestHelper.GenerateRandomData <ServiceFunction>(b =>
                    {
                        b.ServiceDomain = UnitTestHelper.GenerateRandomData <ServiceDomain>(c =>
                        {
                            c.ServiceDeskId = 1;
                            c.ServiceDesk   = UnitTestHelper.GenerateRandomData <ServiceDesk>(d =>
                            {
                                d.Id         = 1;
                                d.DeskName   = "Service Desk One";
                                d.CustomerId = CustomerId;
                                d.Customer   = UnitTestHelper.GenerateRandomData <Customer>(e =>
                                {
                                    e.Id           = CustomerId;
                                    e.CustomerName = "3663";
                                });
                            });
                        });
                    });
                    a.ServiceActivities = ServiceActivity;
                    CreateServiceOrganisationResolver(a, ServiceDeliveryOrganisationNames.Fujitsu, 1);
                }),

                UnitTestHelper.GenerateRandomData <ServiceComponent>(a =>
                {
                    a.ServiceFunction = UnitTestHelper.GenerateRandomData <ServiceFunction>(b =>
                    {
                        b.ServiceDomain = UnitTestHelper.GenerateRandomData <ServiceDomain>(c =>
                        {
                            c.ServiceDeskId = 1;
                            c.ServiceDesk   = UnitTestHelper.GenerateRandomData <ServiceDesk>(d =>
                            {
                                d.Id         = 1;
                                d.DeskName   = "Service Desk One";
                                d.CustomerId = CustomerId;
                                d.Customer   = UnitTestHelper.GenerateRandomData <Customer>(e =>
                                {
                                    e.Id           = CustomerId;
                                    e.CustomerName = "3663";
                                });
                            });
                        });
                    });
                    a.ServiceActivities = null;
                    CreateServiceOrganisationResolverNoResolverDependencies(a, ServiceDeliveryOrganisationNames.Fujitsu, 2);
                }),

                UnitTestHelper.GenerateRandomData <ServiceComponent>(a =>
                {
                    a.ServiceFunction = UnitTestHelper.GenerateRandomData <ServiceFunction>(b =>
                    {
                        b.ServiceDomain = UnitTestHelper.GenerateRandomData <ServiceDomain>(c =>
                        {
                            c.ServiceDeskId = 1;
                            c.ServiceDesk   = UnitTestHelper.GenerateRandomData <ServiceDesk>(d =>
                            {
                                d.Id         = 1;
                                d.DeskName   = "Service Desk One";
                                d.CustomerId = CustomerId;
                                d.Customer   = UnitTestHelper.GenerateRandomData <Customer>(e =>
                                {
                                    e.Id           = CustomerId;
                                    e.CustomerName = "3663";
                                });
                            });
                        });
                    });
                    a.ServiceActivities = ServiceActivity;
                    CreateServiceOrganisationResolver(a, ServiceDeliveryOrganisationNames.Customer, 3);
                }),

                UnitTestHelper.GenerateRandomData <ServiceComponent>(a =>
                {
                    a.ServiceActivities = string.Empty;
                    a.ServiceFunction   = UnitTestHelper.GenerateRandomData <ServiceFunction>(b =>
                    {
                        b.ServiceDomain = UnitTestHelper.GenerateRandomData <ServiceDomain>(c =>
                        {
                            c.ServiceDeskId = 1;
                            c.ServiceDesk   = UnitTestHelper.GenerateRandomData <ServiceDesk>(d =>
                            {
                                d.Id         = 1;
                                d.DeskName   = "Service Desk One";
                                d.CustomerId = CustomerId;
                                d.Customer   = UnitTestHelper.GenerateRandomData <Customer>(e =>
                                {
                                    e.Id           = CustomerId;
                                    e.CustomerName = "3663";
                                });
                            });
                        });
                    });
                    a.ServiceActivities = null;
                    CreateServiceOrganisationResolverNoResolverDependencies(a, ServiceDeliveryOrganisationNames.Customer, 4);
                }),

                UnitTestHelper.GenerateRandomData <ServiceComponent>(a =>
                {
                    a.ServiceFunction = UnitTestHelper.GenerateRandomData <ServiceFunction>(b =>
                    {
                        b.ServiceDomain = UnitTestHelper.GenerateRandomData <ServiceDomain>(c =>
                        {
                            c.ServiceDeskId = 1;
                            c.ServiceDesk   = UnitTestHelper.GenerateRandomData <ServiceDesk>(d =>
                            {
                                d.Id         = 1;
                                d.DeskName   = "Service Desk One";
                                d.CustomerId = CustomerId;
                                d.Customer   = UnitTestHelper.GenerateRandomData <Customer>(e =>
                                {
                                    e.Id           = CustomerId;
                                    e.CustomerName = "3663";
                                });
                            });
                        });
                    });
                    a.ServiceActivities = null;
                    CreateServiceOrganisationResolver(a, ServiceDeliveryOrganisationNames.CustomerThirdParty, 5);
                }),

                UnitTestHelper.GenerateRandomData <ServiceComponent>(a =>
                {
                    a.ServiceFunction = UnitTestHelper.GenerateRandomData <ServiceFunction>(b =>
                    {
                        b.ServiceDomain = UnitTestHelper.GenerateRandomData <ServiceDomain>(c =>
                        {
                            c.ServiceDeskId = 1;
                            c.ServiceDesk   = UnitTestHelper.GenerateRandomData <ServiceDesk>(d =>
                            {
                                d.Id         = 1;
                                d.DeskName   = "Service Desk One";
                                d.CustomerId = CustomerId;
                                d.Customer   = UnitTestHelper.GenerateRandomData <Customer>(e =>
                                {
                                    e.Id           = CustomerId;
                                    e.CustomerName = "3663";
                                });
                            });
                        });
                    });
                    a.ServiceActivities = null;
                    CreateServiceOrganisationResolverNoResolverDependencies(a, ServiceDeliveryOrganisationNames.CustomerThirdParty, 6);
                }),

                _serviceComponentMoveResolverSource,
                _serviceComponentMoveResolverDestination,
                _serviceComponentMoveResolverDestinationWithDependencies
            };

            #endregion

            _mockServiceComponentRepository = MockRepositoryHelper.Create(_serviceComponents,
                                                                          (entity, id) => entity.Id == (int)id,
                                                                          (p1, p2) => p1.Id == p2.Id);

            _mockResolverRepository = MockRepositoryHelper.Create(_resolvers,
                                                                  (entity, id) => entity.Id == (int)id);

            _mockUnitOfWork = new Mock <IUnitOfWork>();

            _mockUserIdentity = new Mock <IUserIdentity>();
            _mockUserIdentity.Setup(s => s.Name).Returns(UserName);

            _target = new ServiceComponentService(_mockServiceComponentRepository.Object,
                                                  _mockResolverRepository.Object,
                                                  _mockUnitOfWork.Object,
                                                  _mockUserIdentity.Object);
        }