예제 #1
0
        public void Setup()
        {
            _companyId = 123L;
            _personalRiskAssessmentId = 888L;

            _returnedViewModel = new ChecklistManagerViewModel()
            {
                PersonalRiskAssessementEmployeeChecklistStatus = PersonalRiskAssessementEmployeeChecklistStatusEnum.Generated
            };

            _viewModelFactory = new Mock<IChecklistManagerViewModelFactory>();
            _employeeChecklistSummaryViewModelFactory = new Mock<IEmployeeChecklistSummaryViewModelFactory>();
            
            _target = GetTarget();
            _currentUserId = _target.CurrentUser.UserId;

            _viewModelFactory
                .Setup(x => x.WithCompanyId(_companyId))
                .Returns(_viewModelFactory.Object);
            _viewModelFactory
                .Setup(x => x.WithRiskAssessmentId(_personalRiskAssessmentId))
                .Returns(_viewModelFactory.Object);
            _viewModelFactory
                .Setup(x => x.WithCurrentUserId(_currentUserId))
                .Returns(_viewModelFactory.Object);
            _viewModelFactory.Setup(x => x.GetViewModel()).Returns(_returnedViewModel);

            _employeeChecklistSummaryViewModelFactory
                .Setup(x => x.WithEmployeeChecklistId(It.IsAny<Guid>()))
                .Returns(_employeeChecklistSummaryViewModelFactory.Object);

            _employeeChecklistSummaryViewModelFactory
                .Setup(x => x.GetViewModel())
                .Returns(new EmployeeChecklistSummaryViewModel());
        }
예제 #2
0
        public void Setup()
        {
            _viewModelFactory = new Mock<IChecklistManagerViewModelFactory>();
            _employeeChecklistSummaryViewModelFactory = new Mock<IEmployeeChecklistSummaryViewModelFactory>();

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

            _viewModelFactory
                .Setup(x => x.WithCompanyId(CompanyId))
                .Returns(_viewModelFactory.Object);

            _viewModelFactory
                .Setup(x => x.WithRiskAssessmentId(RiskAssessmentId))
                .Returns(_viewModelFactory.Object);

            _viewModelFactory
                .Setup(x => x.WithCurrentUserId(_currentUserId))
                .Returns(_viewModelFactory.Object);
        }
예제 #3
0
        private ChecklistManagerController GetTarget()
        {
            var result = new ChecklistManagerController(_viewModelFactory.Object, _employeeChecklistSummaryViewModelFactory.Object);

            return TestControllerHelpers.AddUserToController(result);
        }