Beispiel #1
0
        public async Task ThenWhenIGetTheAgreementTheMediatorIsCalledWithTheCorrectParameters()
        {
            //Act
            await _orchestrator.GetPdfEmployerAgreement("ACC456", "AGB123", "User1");

            //Assert
            _mediator.Verify(
                x => x.SendAsync(It.Is <GetEmployerAgreementPdfRequest>(c => c.HashedAccountId.Equals("ACC456") && c.UserId.Equals("User1") && c.HashedLegalAgreementId.Equals("AGB123"))));
        }
        public async Task <ActionResult> GetPdfAgreement(string agreementId, string hashedAccountId)
        {
            var stream = await _orchestrator.GetPdfEmployerAgreement(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> GetPdfAgreement(string agreementId, string hashedAccountId)
        {
            var stream = await _orchestrator.GetPdfEmployerAgreement(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"));
        }