public void Setup()
        {
            _mediator = new Mock <IMediator>();

            _agreementMapper = new Mock <IAgreementMapper>();

            _orchestrator = new AgreementOrchestrator(_mediator.Object,
                                                      Mock.Of <IHashingService>(),
                                                      Mock.Of <IProviderCommitmentsLogger>(),
                                                      _agreementMapper.Object,
                                                      Mock.Of <ICsvFormatter>(),
                                                      Mock.Of <IExcelFormatter>());
        }
        public void Arrange()
        {
            _mediator  = new Mock <IMediator>();
            _mapper    = ConfigureMapper();
            _agreement = new EmployerAgreementView();

            var response = new GetEmployerAgreementByIdResponse()
            {
                EmployerAgreement = _agreement
            };

            _orchestrator = new AgreementOrchestrator(_mediator.Object, _mapper);

            _mediator.Setup(x => x.SendAsync(It.IsAny <GetEmployerAgreementByIdRequest>()))
            .ReturnsAsync(response);
        }
        public async Task ThenReturnsByteArrayFromCsvFormatter(
            long providerId,
            byte[] expectedResult,
            GetCommitmentAgreementsQueryResponse getAgreementsResponse,
            [Frozen] Mock <IMediator> mockMediator,
            [Frozen] Mock <ICsvFormatter> mockCsvFormatter,
            AgreementOrchestrator sut)
        {
            mockMediator
            .Setup(mediator =>
                   mediator.Send(It.Is <GetCommitmentAgreementsQueryRequest>(request =>
                                                                             request.ProviderId == providerId), It.IsAny <CancellationToken>()))
            .ReturnsAsync(getAgreementsResponse);

            mockCsvFormatter
            .Setup(formatter => formatter.Format(It.IsAny <IEnumerable <CommitmentAgreement> >()))
            .Returns(expectedResult);

            var result = await sut.GetAgreementsAsCsv(providerId);

            result.Should().BeEquivalentTo(expectedResult);
        }
Ejemplo n.º 4
0
 public EmployerAgreementController(AgreementOrchestrator orchestrator)
 {
     _orchestrator = orchestrator;
 }
 public AgreementController(AgreementOrchestrator orchestrator, ICookieStorageService <FlashMessageViewModel> flashMessage) : base(flashMessage)
 {
     _orchestrator = orchestrator;
 }