Ejemplo n.º 1
0
        public async Task Then_The_Service_Is_Called_With_The_Request_To_Remove(
            RemoveAccountLegalEntityCommand command,
            [Frozen] Mock <ILegalEntitiesService> legalEntitiesService,
            RemoveAccountLegalEntityCommandHandler handler)
        {
            await handler.Handle(command, CancellationToken.None);

            legalEntitiesService.Verify(x => x.DeleteAccountLegalEntity(command.AccountId, command.AccountLegalEntityId), Times.Once);
        }
Ejemplo n.º 2
0
        public RemoveAccountLegalEntityCommandHandlerTestsFixture()
        {
            Now                = DateTime.UtcNow;
            Account            = ObjectActivator.CreateInstance <Account>().Set(a => a.Id, 1);
            AccountLegalEntity = ObjectActivator.CreateInstance <AccountLegalEntity>().Set(ale => ale.Id, 2).Set(ale => ale.AccountId, Account.Id);
            Command            = new RemoveAccountLegalEntityCommand(Account.Id, AccountLegalEntity.Id, Now.AddHours(-1));
            Db = new ProviderCommitmentsDbContext(new DbContextOptionsBuilder <ProviderCommitmentsDbContext>().UseInMemoryDatabase(Guid.NewGuid().ToString()).ConfigureWarnings(warnings => warnings.Throw(RelationalEventId.QueryClientEvaluationWarning)).Options);

            Db.Accounts.Add(Account);
            Db.AccountLegalEntities.Add(AccountLegalEntity);
            Db.SaveChanges();

            Handler           = new RemoveAccountLegalEntityCommandHandler(new Lazy <ProviderCommitmentsDbContext>(() => Db));
            UnitOfWorkContext = new UnitOfWorkContext();
        }
        public void Arrange()
        {
            _accountLegalEntityRepository = new Mock <IAccountLegalEntityRepository>();

            _handler = new RemoveAccountLegalEntityCommandHandler(_accountLegalEntityRepository.Object, Mock.Of <ILog>());
        }