public void When_I_use_a_client_with_invalid_creds_Then_it_should_throw_InvalidCredentialsException_async()
        {
            var invalidCardPaymentService = SampleFactory.CreateSampleInvalidCardPaymentService();
            var auth = SampleFactory.CreateSampleCustomAuthorization("noException");

            Assert.ThrowsAsync <Paysafe.Common.InvalidCredentialsException>(async() => await invalidCardPaymentService.AuthorizeAsync(auth));
        }
        public void When_I_send_an_auth_more_than_once_Then_it_should_throw_RequestConflictException_sync()
        {
            var auth = SampleFactory.CreateSampleCustomAuthorization("noException");

            _cardPaymentService.Authorize(auth);
            Assert.Throws <Paysafe.Common.RequestConflictException>(() => _cardPaymentService.Authorize(auth));
        }
        public void When_I_send_an_auth_with_negative_amount_Then_it_should_throw_InvalidRequestException_async()
        {
            var auth = SampleFactory.CreateSampleCustomAuthorization("noException");

            auth.Amount(-1);

            Assert.ThrowsAsync <Paysafe.Common.InvalidRequestException>(async() => await _cardPaymentService.AuthorizeAsync(auth));
        }
        public void When_a_request_is_declined_Then_it_should_throw_RequestDeclinedException__async()
        {
            var auth = SampleFactory.CreateSampleCustomAuthorization("requestDeclined");

            Assert.ThrowsAsync <Paysafe.Common.RequestDeclinedException>(async() => await _cardPaymentService.AuthorizeAsync(auth));
        }
        public void When_a_card_without_billing_details_is_used_Then_it_should_throw_InvalidRequestException_async()
        {
            var auth = SampleFactory.CreateSampleIncompleteAuthorization();

            Assert.ThrowsAsync <Paysafe.Common.InvalidRequestException>(async() => await _cardPaymentService.AuthorizeAsync(auth));
        }
        public void When_an_internal_error_occurs_Then_it_should_throw_ApiException_async()
        {
            var auth = SampleFactory.CreateSampleCustomAuthorization("apiException");

            Assert.ThrowsAsync <Paysafe.Common.ApiException>(async() => await _cardPaymentService.AuthorizeAsync(auth));
        }
 public void SetUp()
 {
     _cardPaymentService = SampleFactory.CreateSampleCardPaymentService();
 }