public void CreateAccountEmailConflictTest() { ContentAPI client = ConstructServiceClient(); long ticks = DateTime.Now.Ticks; String merchantID = ticks.ToString(); String email = "test@" + merchantID + ".com"; String firstName = "Unit"; String lastName = "Test"; String company = merchantID + " Inc."; String country = "US"; String vatID = "12334455544"; Account account1 = client.CreateAccount(merchantID, email, firstName, lastName, company, country, vatID); Assert.IsNotNull(account1, "The account should have been created."); try { Account account2 = client.CreateAccount(merchantID, email, firstName, lastName, company, country, vatID); Assert.Fail("Created an account with a duplicate email address."); } catch (OnDemandClientException odce) { Assert.AreEqual <HttpStatusCode>(HttpStatusCode.Conflict, odce.HttpStatusCode); Assert.AreEqual <Int32>(404, odce.ReasonCode); Assert.IsNotNull(odce.SimpleMessage); Assert.IsNotNull(odce.DetailedMessage); } }
public void CreateAccountBadCountryTest() { ContentAPI client = ConstructServiceClient(); long ticks = DateTime.Now.Ticks; String merchantID = ticks.ToString(); String email = "test@" + merchantID + ".com"; String firstName = "Unit"; String lastName = "Test"; String company = merchantID + " Inc."; String country = "XX"; String vatID = "12334455544"; try { Account account = client.CreateAccount(merchantID, email, firstName, lastName, company, country, vatID); Assert.Fail("Created an account with an invalid invalid country code."); } catch (OnDemandClientException odce) { Assert.AreEqual <Int32>(400, odce.ReasonCode); Assert.IsNotNull(odce.SimpleMessage); Assert.IsNotNull(odce.DetailedMessage); } }
public void CreateAccountConstructorTest() { ContentAPI client = ConstructServiceClient(); long ticks = DateTime.Now.Ticks; String merchantID = ticks.ToString(); String email = "test@" + merchantID + ".com"; String firstName = "Unit"; String lastName = "Test"; String company = merchantID + " Inc."; String country = "US"; String vatID = "12334455544"; Account account = client.CreateAccount(merchantID, email, firstName, lastName, company, country, vatID); CreateAccountCommonAsserts(account, merchantID, email, firstName, lastName, company, country); }
//[ExpectedException(typeof(OnDemandClientException))] public void CreateAccountIENoVatIDTest() { ContentAPI client = ConstructServiceClient(); long ticks = DateTime.Now.Ticks; String merchantID = ticks.ToString(); String email = "test@" + merchantID + ".com"; String firstName = "Unit"; String lastName = "Test"; String company = merchantID + " Inc."; String country = "IE"; String vatID = ""; // This request should throw an exception because VAT ID's are required in Ireland (IE) Account account = client.CreateAccount(merchantID, email, firstName, lastName, company, country, vatID); CreateAccountCommonAsserts(account, merchantID, email, firstName, lastName, company, country); }