#suzz1911

1 messages · Page 1 of 1 (latest)

dusty pumiceBOT
blazing mountain
#

Hi! What exactly Stripe-related do you want to test?

last spoke
#

i've created apis for checkout-session, customer-portal get and post apis

#

i want to create unti tests for them. for that i want to know how can i moq the stipe

blazing mountain
#

Are you using the .NET Stripe SDK?

last spoke
#

private readonly Mock<IStripeClient> _client;
new Mock<CustomerService>(_client);
etc

#

var customerList = new Mock<StripeList<Customer>>();

#

or how can i moq the stripe, so that the unit test will work

blazing mountain
#

You can call the Test mode API in your tests, that's fine

last spoke
#

so this will correct response

#

Mock<StripeList<Customer>> customerList = new Mock<StripeList<Customer>>();
customerList.Data.Add(new Customer { Id = "cus_test" });

Cannot resolve symbol 'Data'

#

this is error when i tried ti use like this

blazing mountain
#

I don't know how .NET mocks work, unfortunately. But as I said, you can call real Stripe API in your tests, and avoid mocks.

last spoke
#

ok