private ChecklistGeneratorController GetTarget()
        {
            var controller = new ChecklistGeneratorController(
                null,
                null,
                _personalRiskAssessmentService.Object,
                null,
                null,
                null);

            return TestControllerHelpers.AddUserToController(controller);
        }
Esempio n. 2
0
        public void Setup()
        {
            _companyId = 123L;
            _personalRiskAssessmentId = 333333L;

            _returnedViewModel = new EmployeeChecklistGeneratorViewModel();
            _checklistGeneratorViewModelFactory = new Mock<IEmployeeChecklistGeneratorViewModelFactory>();
            _businessSafeSessionManager = new Mock<IBusinessSafeSessionManager>();

            _target = GetTarget();
            _currentUserId = _target.CurrentUser.UserId;

            _checklistGeneratorViewModelFactory.Setup(x => x.WithCompanyId(_companyId)).Returns(_checklistGeneratorViewModelFactory.Object);
            _checklistGeneratorViewModelFactory.Setup(x => x.WithRiskAssessmentId(_personalRiskAssessmentId)).Returns(_checklistGeneratorViewModelFactory.Object);
            _checklistGeneratorViewModelFactory.Setup(x => x.WithRiskAssessorEmail(TestControllerHelpers.EmailAssigned)).Returns(_checklistGeneratorViewModelFactory.Object);
            _checklistGeneratorViewModelFactory.Setup(x => x.WithCurrentUserId(_currentUserId)).Returns(_checklistGeneratorViewModelFactory.Object);
            _checklistGeneratorViewModelFactory.Setup(x => x.GetViewModel()).Returns(_returnedViewModel);
        }
Esempio n. 3
0
        private ChecklistGeneratorController GetTarget()
        {
            var controller = new ChecklistGeneratorController(
                _checklistGeneratorViewModelFactory.Object,
                null,
                null,
                null,
                null,
                _businessSafeSessionManager.Object
                );

            return TestControllerHelpers.AddUserToController(controller);
        }
Esempio n. 4
0
        public void Setup()
        {
            _employeeService = new Mock<IEmployeeService>();
            _employeeChecklistEmailService = new Mock<IEmployeeChecklistEmailService>();
            _personalRiskAssessmentService = new Mock<IPersonalRiskAssessmentService>();
            _checklistService = new Mock<IChecklistService>();
            _siteService = new Mock<ISiteService>();
            _businessSafeSessionManager=new Mock<IBusinessSafeSessionManager>();
            _bus = new Mock<IBus>();
            _selectedEmployeeViewModelFactory = new SelectedEmployeeViewModelFactory(_personalRiskAssessmentService.Object);
            _checklistGeneratorViewModelFactory = new EmployeeChecklistGeneratorViewModelFactory(_employeeService.Object, _checklistService.Object, _personalRiskAssessmentService.Object, _siteService.Object, _selectedEmployeeViewModelFactory);
            _companyId = 23522L;
            _riskAssessmentId = 342L;
            _message = "Test Message";

            _employees = new List<EmployeeDto>
                             {
                                 new EmployeeDto
                                     {
                                         Id = _currentUserId,
                                         FullName = "Mark Mauve",
                                         MainContactDetails = new EmployeeContactDetailDto{ Email = "*****@*****.**"}
                                     },
                                 new EmployeeDto
                                     {
                                         Id = new Guid("cf7ce0b2-8a97-4c32-8af1-ce3c96716fdd"),
                                         FullName = "Peter Pink"
                                     },
                                 new EmployeeDto
                                     {
                                         Id = new Guid("0b20512d-3b4e-4da3-ab8c-6433c3fa4118"),
                                         FullName = "Guy Grey",
                                         MainContactDetails = new EmployeeContactDetailDto{ Email = "*****@*****.**"}
                                     }
                             };

            _checklists = new List<ChecklistDto>
                              {
                                  new ChecklistDto
                                      {
                                          Id = 1L,
                                          Title = "Test Checklist 01"
                                      },
                                  new ChecklistDto
                                      {
                                          Id = 2L,
                                          Title = "Test Checklist 02"
                                      },
                                  new ChecklistDto
                                      {
                                          Id = 3L,
                                          Title = "Test Checklist 03"
                                      },
                              };

            _basePersonalRiskAssessment = new PersonalRiskAssessmentDto
                                              {
                                                  Id = _riskAssessmentId,
                                                  ChecklistGeneratorEmployees = new EmployeeDto[0],
                                                  Checklists = new ChecklistDto[0],
                                                  ChecklistGeneratorMessage = _message
                                              };

            _target = GetTarget();
            _currentUserId = _target.CurrentUser.UserId;

            _employeeService
                .Setup(x => x.GetAll(_companyId))
                .Returns(_employees);

            _checklistService
                .Setup(x => x.GetByRiskAssessmentType(ChecklistRiskAssessmentType.Personal))
                .Returns(_checklists);

            _siteService
                .Setup(x => x.GetAll(_companyId))
                .Returns(new List<SiteDto>());
        }
Esempio n. 5
0
        private ChecklistGeneratorController GetTarget()
        {
            var controller = new ChecklistGeneratorController(
                _checklistGeneratorViewModelFactory,
                _employeeService.Object,
                _personalRiskAssessmentService.Object,
                _selectedEmployeeViewModelFactory,
                _bus.Object,
                _businessSafeSessionManager.Object);

            return TestControllerHelpers.AddUserToController(controller);
        }