public void Arrange()
        {
            _fixture = new Fixture();
            _fixture.Customize(new IncentiveApplicationCustomization());

            _mockDomainRepository = new Mock <IAccountDomainRepository>();
            _mockCommandPublisher = new Mock <ICommandPublisher>();

            _sut = new UpdateVendorRegistrationCaseStatusCommandHandler(_mockCommandPublisher.Object, _mockDomainRepository.Object);
        }
Example #2
0
        public async Task Then_The_legal_entity_is_updated_with_the_supplied_case_status(
            [Frozen] Mock <IEmployerIncentivesService> incentivesService,
            UpdateVendorRegistrationCaseStatusCommandHandler handler,
            UpdateVendorRegistrationCaseStatusCommand command)
        {
            var legalEntity = new Fixture().Create <AccountLegalEntity>();

            legalEntity.AccountId            = command.AccountId;
            legalEntity.AccountLegalEntityId = command.AccountLegalEntityId;
            incentivesService.Setup(x => x.GetLegalEntity(command.AccountId, command.AccountLegalEntityId))
            .ReturnsAsync(legalEntity);

            await handler.Handle(command, CancellationToken.None);

            incentivesService.Verify(x => x.GetLegalEntity(command.AccountId, command.AccountLegalEntityId), Times.Once);
            incentivesService.Verify(x => x.UpdateVendorRegistrationCaseStatus(It.Is <UpdateVendorRegistrationCaseStatusRequest>
                                                                                   (y => y.HashedLegalEntityId == legalEntity.HashedLegalEntityId && y.Status == command.VrfCaseStatus)), Times.Once);
        }