private static void Test_CreateCustomer() { Console.Write("[{0}] Testing create customer... ", Timestamp); var stripe = new StripeService(API_KEY); Customer customer = stripe.CreateCustomerAsync(SAMPLE_CUSTOMER_EMAIL, "A sample customer.").Result; if (customer == null) { Console.WriteLine(); if (!stripe.HasError) { throw new TestFailedException("Customer creation failed for unknown reasons."); } throw new TestFailedException("Customer creation failed ({0}): {1} {2}", stripe.Error.Type, stripe.Error.Message, stripe.Error.Parameter); } _testCustomerId = customer.Id; Console.WriteLine("pass"); }
private static void Test_CreateDuplicateCustomer() { Console.Write("[{0}] Testing create customer with existing email... ", Timestamp); var stripe = new StripeService(API_KEY); Customer customer = stripe.CreateCustomerAsync(SAMPLE_CUSTOMER_EMAIL, "A sample customer.").Result; if (customer != null) { Console.WriteLine(); throw new TestFailedException("Customer was created and should not have been."); } Console.WriteLine("pass"); }