public async Task Then_The_Event_Is_Mapped_And_The_Repository_Called()
        {
            //Arrange
            var accountLegalEntityRemovedEvent = new RemovedLegalEntityEvent();

            //Act
            await _service.RemoveAccountLegalEntity(accountLegalEntityRemovedEvent);

            //Assert
            _repository.Verify(x => x.Remove(It.Is <AccountLegalEntity>(c => c.AccountLegalEntityId.Equals(accountLegalEntityRemovedEvent.AccountLegalEntityId))), Times.Once);
        }
        public async Task Then_The_Service_Is_Called_To_Remove_The_Entity()
        {
            //Arrange
            var accountLegalEntityRemovedEvent = new RemovedLegalEntityEvent {
                AccountLegalEntityId = 5
            };

            //Act
            await _handler.Handle(accountLegalEntityRemovedEvent);

            //Assert
            _service.Verify(x => x.RemoveAccountLegalEntity(It.Is <RemovedLegalEntityEvent>(
                                                                c => c.AccountLegalEntityId.Equals(accountLegalEntityRemovedEvent.AccountLegalEntityId))));
        }
Ejemplo n.º 3
0
        public async Task Then_Queue_Message_Will_Be_Handled()
        {
            //Arrange
            var handle  = new Mock <IRemoveLegalEntityHandler>();
            var message = new RemovedLegalEntityEvent {
                AccountId = 5432
            };

            //Act
            await HandleRemovedLegalEntityEvent.Run(message, handle.Object, Mock.Of <ILogger <RemovedLegalEntityEvent> >());

            //Assert
            handle.Verify(s => s.Handle(It.Is <RemovedLegalEntityEvent>(c => c.AccountId.Equals(message.AccountId))), Times.Once);
        }
Ejemplo n.º 4
0
        public RemovedLegalEntityEventHandlerTestsFixture()
        {
            Message = new RemovedLegalEntityEvent()
            {
                AccountId            = AccountId,
                UserRef              = UserRef,
                Created              = Created,
                AccountLegalEntityId = AccountLegalEntityId,
                AgreementId          = AgreementId,
                LegalEntityId        = LegalEntityId,
                OrganisationName     = OrganisationName,
                UserName             = UserName,
                AgreementSigned      = AgreementSigned
            };

            Mediator = new Mock <IMediator>();
            Handler  = new RemovedLegalEntityEventHandler(Mediator.Object);
        }
Ejemplo n.º 5
0
 public async Task Handle(RemovedLegalEntityEvent accountLegalEntityRemovedEvent)
 {
     await _service.RemoveAccountLegalEntity(accountLegalEntityRemovedEvent);
 }
Ejemplo n.º 6
0
 public async Task RemoveAccountLegalEntity(RemovedLegalEntityEvent accountLegalEntityRemovedEvent)
 {
     await _repository.Remove(MapAccountLegalEntity(accountLegalEntityRemovedEvent));
 }