Example #1
0
        public async Task ThenTheLegalEntityIsCreated()
        {
            //Act
            var result = await _commandHandler.Handle(_command);

            //Assert
            Assert.AreSame(_agreementView, result.AgreementView);
        }
        public async Task ThenTheAccountDataIsRetrievedAndSaved()
        {
            var expectedLegalEntity = new LegalEntityViewModelBuilder().Build();
            var legalEntityHref     = $"/api/accounts/{expectedLegalEntity.DasAccountId}/legalentities/{expectedLegalEntity.LegalEntityId}";

            _accountGateway.Setup(x => x.GetLegalEntity(legalEntityHref)).ReturnsAsync(expectedLegalEntity);

            await _commandHandler.Handle(new CreateLegalEntityCommand()
            {
                LegalEntityHref = legalEntityHref
            });

            _legalEntityRepository.Verify(x => x.SaveLegalEntity(expectedLegalEntity), Times.Once);
        }
Example #3
0
 public void ThenTheLegalEntityIsNotCreated()
 {
     //Act &
     //Assert
     Assert.ThrowsAsync <UnauthorizedAccessException>(async() => await _commandHandler.Handle(_command));
 }