Ejemplo n.º 1
0
        public async Task ThenWhenIGetTheSignedAgreementTheMediatorIsCalledWithTheCorrectParameters()
        {
            //Arrange
            var expectedHashedAccountId   = "123RDF";
            var expectedHashedAgreementId = "567TGB";
            var expectedUserId            = "123AVC";

            //Act
            await
            _orchestrator.GetSignedPdfEmployerAgreement(expectedHashedAccountId, expectedHashedAgreementId,
                                                        expectedUserId);

            //Assert
            _mediator.Verify(x => x.SendAsync(It.Is <GetSignedEmployerAgreementPdfRequest>(c =>
                                                                                           c.HashedAccountId.Equals(expectedHashedAccountId) && c.UserId.Equals(expectedUserId) &&
                                                                                           c.HashedLegalAgreementId.Equals(expectedHashedAgreementId))));
        }
        public async Task <ActionResult> GetSignedPdfAgreement(string agreementId, string hashedAccountId)
        {
            var stream = await _orchestrator.GetSignedPdfEmployerAgreement(hashedAccountId, agreementId, OwinWrapper.GetClaimValue(ControllerConstants.UserRefClaimKeyName));

            if (stream.Data.PdfStream == null)
            {
                // ReSharper disable once Mvc.ViewNotResolved
                return(View(stream));
            }

            return(new FileStreamResult(stream.Data.PdfStream, ControllerConstants.PdfContentTypeName));
        }
        public async Task <ActionResult> GetSignedPdfAgreement(string agreementId, string hashedAccountId)
        {
            var stream = await _orchestrator.GetSignedPdfEmployerAgreement(hashedAccountId, agreementId, OwinWrapper.GetClaimValue("sub"));

            if (stream.Data.PdfStream == null)
            {
                // ReSharper disable once Mvc.ViewNotResolved
                return(View(stream));
            }

            return(new FileStreamResult(stream.Data.PdfStream, "application/pdf"));
        }