Ejemplo n.º 1
0
        public async Task CreditCard_Should_BeSavedAndRestored()
        {
            var owner = new AccountOwnerBuilder().Build();

            var creditCard = new CreditCardBuilder()
                             .WithLimit(100)
                             .WithOwnerId(owner.Id)
                             .Build();

            using (var context = new CreditCardContext())
            {
                var accountOwnerRepository = new AccountOwnerRepository(context);
                var creditCardRepository   = new CreditCardRepository(context);

                await accountOwnerRepository.Add(owner);

                await creditCardRepository.Add(creditCard);

                await context.SaveChangesAsync();

                var storedCreditCard = await creditCardRepository.Get(creditCard.Id);

                storedCreditCard.Should().NotBeNull();
                storedCreditCard.AvaliableLimit.Should().Be(creditCard.AvaliableLimit);
                storedCreditCard.OwnerId.Should().Be(creditCard.OwnerId);
            }
        }
Ejemplo n.º 2
0
 public CreditCardRepository(CreditCardContext context)
 {
     _context = context;
 }
Ejemplo n.º 3
0
 public AccountOwnerRepository(CreditCardContext context)
 {
     _context = context;
 }