Esempio n. 1
0
        public EmployerAgreementControllerTestFixtures WithUnsignedEmployerAgreement()
        {
            var agreementResponse = new GetEmployerAgreementResponse
            {
                EmployerAgreement = new AgreementDto {
                    LegalEntity = new AccountSpecificLegalEntityDto {
                        AccountLegalEntityId = AccountLegalEntityId
                    }
                }
            };

            Mediator.Setup(x => x.SendAsync(It.Is <GetEmployerAgreementRequest>(r => r.AgreementId == GetAgreementRequest.AgreementId && r.HashedAccountId == GetAgreementRequest.HashedAccountId)))
            .ReturnsAsync(agreementResponse);
            var entitiesCountResponse = new GetAccountLegalEntitiesCountByHashedAccountIdResponse
            {
                LegalEntitiesCount = 1
            };

            Mediator.Setup(x => x.SendAsync(It.IsAny <GetAccountLegalEntitiesCountByHashedAccountIdRequest>()))
            .ReturnsAsync(entitiesCountResponse);

            Mapper.Setup(x => x.Map <GetEmployerAgreementResponse, EmployerAgreementViewModel>(agreementResponse))
            .Returns(GetAgreementToSignViewModel);

            Mapper.Setup(x => x.Map <GetEmployerAgreementResponse, SignEmployerAgreementViewModel>(agreementResponse))
            .Returns(GetSignAgreementViewModel);

            Orchestrator.Setup(x => x.GetById(GetAgreementRequest.AgreementId, GetAgreementRequest.HashedAccountId, GetAgreementRequest.ExternalUserId))
            .ReturnsAsync(new OrchestratorResponse <EmployerAgreementViewModel> {
                Data = GetAgreementToSignViewModel
            });

            return(this);
        }
Esempio n. 2
0
        public async Task Handle(string hashedAccountId, long agreementId, Guid externalUserId)
        {
            EmployerAgreementBuilder.EvaluateSignedAndPendingAgreementIdsForAllAccountLegalEntities();
            EmployerAgreementBuilder.SetupMockDbContext();
            var request = BuildRequest(hashedAccountId, agreementId, externalUserId);

            var handler = new GetEmployerAgreementQueryHandler(
                new Lazy <EmployerAccountsDbContext>(() => EmployerAgreementBuilder.EmployerAccountDbContext),
                EmployerAgreementBuilder.HashingService,
                Validator.Object,
                ConfigurationProvider);

            Response = await handler.Handle(request);
        }
        public EmployerAgreementControllerTestFixtures WithUnsignedEmployerAgreement()
        {
            var response = new GetEmployerAgreementResponse
            {
                EmployerAgreement = new AgreementDto()
            };

            Mediator.Setup(x => x.SendAsync(GetAgreementRequest))
            .ReturnsAsync(response);

            Mapper.Setup(x => x.Map <GetEmployerAgreementResponse, EmployerAgreementViewModel>(response))
            .Returns(GetAgreementToSignViewModel);

            return(this);
        }