Exemplo n.º 1
0
        public ServiceDeskController(IServiceDeskService serviceDeskService,
                                     IInputTypeRefDataService inputTypeRefDataService,
                                     ITemplateService templateService,
                                     IContextManager contextManager,
                                     IAppUserContext appUserContext)
        {
            if (serviceDeskService == null)
            {
                throw new ArgumentNullException(nameof(serviceDeskService));
            }
            if (inputTypeRefDataService == null)
            {
                throw new ArgumentNullException(nameof(inputTypeRefDataService));
            }
            if (templateService == null)
            {
                throw new ArgumentNullException(nameof(templateService));
            }
            if (contextManager == null)
            {
                throw new ArgumentNullException(nameof(contextManager));
            }
            if (appUserContext == null)
            {
                throw new ArgumentNullException(nameof(appUserContext));
            }

            _serviceDeskService      = serviceDeskService;
            _inputTypeRefDataService = inputTypeRefDataService;
            _templateService         = templateService;
            _contextManager          = contextManager;
            _appUserContext          = appUserContext;
        }
        public void TestInitilize()
        {
            _unitOfWork = new Mock <IUnitOfWork>();

            _inputTypes = new List <InputTypeRefData>
            {
                new InputTypeRefData {
                    Id = 1, InputTypeNumber = 1, InputTypeName = "Input A", SortOrder = 5
                },
                new InputTypeRefData {
                    Id = 2, InputTypeNumber = 2, InputTypeName = "Input B", SortOrder = 5
                },
                new InputTypeRefData {
                    Id = 3, InputTypeNumber = 3, InputTypeName = "Input C", SortOrder = 5
                },
                new InputTypeRefData {
                    Id = 4, InputTypeNumber = 4, InputTypeName = "Input D", SortOrder = 5
                }
            };

            _mockInputTypeRefDataRepository = MockRepositoryHelper.Create(_inputTypes);

            _deskInputTypes = new List <DeskInputType>
            {
                UnitTestHelper.GenerateRandomData <DeskInputType>(x =>
                {
                    x.Id = 1;
                    x.InputTypeRefData = _inputTypes.First(y => y.Id == 1);
                }),
                UnitTestHelper.GenerateRandomData <DeskInputType>(x =>
                {
                    x.Id = 2;
                    x.InputTypeRefData = _inputTypes.First(y => y.Id == 1);
                }),
                UnitTestHelper.GenerateRandomData <DeskInputType>(x =>
                {
                    x.Id = 3;
                    x.InputTypeRefData = _inputTypes.First(y => y.Id == 1);
                }),
                UnitTestHelper.GenerateRandomData <DeskInputType>(x =>
                {
                    x.Id = 4;
                    x.InputTypeRefData = _inputTypes.First(y => y.Id == 3);
                }),
            };

            _mockDeskInputTypeRepository = MockRepositoryHelper.Create(_deskInputTypes);

            _inputTypeRefDataService = new InputTypeRefDataService(
                _mockInputTypeRefDataRepository.Object, _mockDeskInputTypeRepository.Object, _unitOfWork.Object);

            Bootstrapper.SetupAutoMapper();
        }