public static Card CreateSampleCard(Profile profile, Address address)
 {
     return(Card.Builder()
            .ProfileId(profile.Id())
            .CardNum("4111111111111111")
            .CardExpiry()
            .Month(DateTime.Now.Month)
            .Year(DateTime.Now.AddYears(1).Year)
            .Done()
            .BillingAddressId(address.Id())
            .Build());
 }
        public void When_I_lookup_a_card_Then_it_should_return_a_valid_card_sync()
        {
            _profile = _service.Create(_profile);
            var card = SampleFactory.CreateSampleCard(_profile);

            card = _service.Create(card);

            var returnedCard = _service.Get(Card.Builder()
                                            .Id(card.Id())
                                            .ProfileId(_profile.Id())
                                            .Build());

            Assert.That(CardsAreEquivalent(card, returnedCard));
        }
 public static Card CreateSampleCard(Profile profile)
 {
     return(Card.Builder()
            .ProfileId(profile.Id())
            .CardNum("4111111111111111")
            .CardExpiry()
            .Month(DateTime.Now.Month)
            .Year(DateTime.Now.AddYears(1).Year)
            .Done()
            .BillingAddress()
            .Street("100 Queen Street West")
            .City("Toronto")
            .State("ON")
            .Country("CA")
            .Zip("M5H2N2")
            .Done()
            .Build());
 }
        public async Task When_I_delete_a_card_Then_it_should_be_deleted_async()
        {
            _profile = await _service.CreateAsync(_profile);

            var card = SampleFactory.CreateSampleCard(_profile);

            card = await _service.CreateAsync(card);

            await _service.DeleteAsync(card);

            Assert.ThrowsAsync <Paysafe.Common.EntityNotFoundException>(async() => await _service.GetAsync(Card.Builder()
                                                                                                           .Id(card.Id())
                                                                                                           .ProfileId(_profile.Id())
                                                                                                           .Build()));
        }
        public void When_I_delete_a_card_Then_it_should_be_deleted_sync()
        {
            _profile = _service.Create(_profile);

            var card = SampleFactory.CreateSampleCard(_profile);

            card = _service.Create(card);

            _service.Delete(card);

            Assert.Throws <Paysafe.Common.EntityNotFoundException>(() => _service.Get(Card.Builder()
                                                                                      .Id(card.Id())
                                                                                      .ProfileId(_profile.Id())
                                                                                      .Build()));
        }