public async Task ThenARequestShouldMakeCallsToGetBalances()
        {
            //Arrange
            const string hashedAgreementId = "ABC123";

            //Act
            var result = await _orchestrator.GetAccount(hashedAgreementId);

            //Assert
            _mediator.VerifyAll();
        }
Example #2
0
        public async Task <IHttpActionResult> GetAccount(string hashedAccountId)
        {
            var result = await _orchestrator.GetAccount(hashedAccountId);

            if (result.Data == null)
            {
                return(NotFound());
            }

            return(Ok(result.Data));
        }
        public async Task <IHttpActionResult> GetAccount(string hashedAccountId)
        {
            var result = await _orchestrator.GetAccount(hashedAccountId);

            if (result.Data == null)
            {
                return(NotFound());
            }

            result.Data.LegalEntities.ForEach(x => CreateGetLegalEntityLink(hashedAccountId, x));
            result.Data.PayeSchemes.ForEach(x => CreateGetPayeSchemeLink(hashedAccountId, x));
            return(Ok(result.Data));
        }
        public async Task ThenResponseShouldHaveAccountAgreementTypeSetToNonLevy()
        {
            //Arrange
            var          agreementType     = AgreementType.NonLevyExpressionOfInterest;
            const string hashedAgreementId = "ABC123";

            var response = new GetEmployerAccountDetailByHashedIdResponse
            {
                Account = new AccountDetail
                {
                    AccountAgreementTypes = new List <AgreementType>
                    {
                        agreementType,
                        agreementType
                    }
                }
            };

            _mediator
            .Setup(x => x.SendAsync(It.IsAny <GetEmployerAccountDetailByHashedIdQuery>()))
            .ReturnsAsync(response)
            .Verifiable("Get account was not called");

            //Act
            var result = await _orchestrator.GetAccount(hashedAgreementId);

            //Assert
            Assert.AreEqual(agreementType.ToString(), result.AccountAgreementType.ToString());
        }
        public async Task ThenARequestShouldMakeCallsToGetBalances()
        {
            //Act
            await _orchestrator.GetAccount(HashedAgreementId);

            //Assert
            _mediator.VerifyAll();
        }
        public async Task TheARequestToGetAccountDetailsShouldBeMade()
        {
            //Arrange
            const string hashedAgreementId = "ABC123";

            //Act
            await _orchestrator.GetAccount(hashedAgreementId);

            //Assert
            _mediator.VerifyAll();
        }
        public async Task ThenResponseShouldHaveAccountAgreementTypeSetToTheLatestAgreementType()
        {
            //Arrange
            AccountAgreementType agreementType     = AccountAgreementType.Combined;
            const string         hashedAgreementId = "ABC123";

            //Act
            var result = await _orchestrator.GetAccount(hashedAgreementId);

            //Assert
            Assert.AreEqual(agreementType, result.AccountAgreementType);
        }
Example #8
0
        public async Task ThenResponseShouldHaveAccountAgreementTypeSetToLevy()
        {
            //Arrange
            AgreementType agreementType     = AgreementType.Levy;
            const string  hashedAgreementId = "ABC123";

            //Act
            var result = await _orchestrator.GetAccount(hashedAgreementId);

            //Assert
            Assert.AreEqual(agreementType.ToString(), result.AccountAgreementType.ToString());
        }
        public async Task <IHttpActionResult> GetLegalEntities(string hashedAccountId)
        {
            var result = await _orchestrator.GetAccount(hashedAccountId);

            if (result.Data == null)
            {
                return(NotFound());
            }

            result.Data.LegalEntities.ForEach(l => l.Href = Url.Route("GetLegalEntity", new { hashedAccountId, legalEntityId = l.Id }));

            return(Ok(result.Data.LegalEntities));
        }
        public async Task ThenResponseShouldHaveAccountAgreementTypeSetToUnknown()
        {
            //Arrange
            var response = new GetEmployerAccountDetailByHashedIdResponse
            {
                Account = new AccountDetail
                {
                    AccountAgreementTypes = new List <AgreementType>()
                }
            };

            _mediator
            .Setup(x => x.SendAsync(It.IsAny <GetEmployerAccountDetailByHashedIdQuery>()))
            .ReturnsAsync(response)
            .Verifiable("Get account was not called");

            //Act
            var result = await _orchestrator.GetAccount("AVC123");

            //Assert
            Assert.AreEqual(AccountAgreementType.Unknown, result.AccountAgreementType);
        }