public void CustomerAccountsGetAccountsComplexFilter() { //CreateAccounts var customerAccounts = Generator.AddAccountsRandom(ApiMsgHandler, 25, 1); var filterBy = "acceptsmarketing eq false"; var sortBy = "createdate asc"; var result = CustomerAccountFactory.GetAccounts(ApiMsgHandler, 0, 25, sortBy, filterBy); Assert.AreEqual(0, result.StartIndex); Assert.AreEqual(25, result.PageSize); Assert.AreEqual(1, result.PageCount); Assert.AreEqual(25, result.TotalCount); filterBy = "commercesummary.wishlistcount eq 0"; sortBy = "commercesummary.totalorderamount desc"; result = CustomerAccountFactory.GetAccounts(ApiMsgHandler, 5, 10, sortBy, filterBy); Assert.AreEqual(5, result.StartIndex); Assert.AreEqual(10, result.PageSize); Assert.AreEqual(3, result.PageCount); Assert.AreEqual(25, result.TotalCount); filterBy = "commercesummary.totalorderamount eq 0"; sortBy = "commercesummary.wishlistcount asc"; result = CustomerAccountFactory.GetAccounts(ApiMsgHandler, 12, null, sortBy, filterBy); Assert.AreEqual(12, result.StartIndex); Assert.AreEqual(20, result.PageSize); Assert.AreEqual(2, result.PageCount); Assert.AreEqual(25, result.TotalCount); }
public void CustomerAccountGetAccount_byId() { //CreateAccounts var customerAccounts = Generator.AddAccountsRandom(ApiMsgHandler, 15, 2); for (int i = 0; i < customerAccounts.Count; i++) { //GetAccount var result = CustomerAccountFactory.GetAccount(ApiMsgHandler, customerAccounts[i].Id); Assert.AreEqual(customerAccounts[i].Id, result.Id); Assert.AreEqual(2, result.Contacts.Count); } }
public void CustomerUpdateAccount_TaxExempt() { //CreateAccounts var customerAccounts = Generator.AddAccountsRandom(ApiMsgHandler, 13, 3); for (int i = 0; i < customerAccounts.Count; i++) { customerAccounts[i].TaxExempt = true; var result = CustomerAccountFactory.UpdateAccount(ApiMsgHandler, customerAccounts[i], customerAccounts[i].Id); Assert.AreEqual(true, result.TaxExempt); //GetAccount var result1 = CustomerAccountFactory.GetAccount(ApiMsgHandler, customerAccounts[i].Id); Assert.AreEqual(true, result1.TaxExempt); Assert.AreEqual(3, result1.Contacts.Count); } }
public void CustomerUpdateAccount_firstName() { //CreateAccounts var customerAccounts = Generator.AddAccountsRandom(ApiMsgHandler, 15, 2); for (int i = 0; i < customerAccounts.Count; i++) { var firstName = Generator.RandomString(25, Generator.RandomCharacterGroup.AlphaNumericOnly); customerAccounts[i].FirstName = firstName; var result = CustomerAccountFactory.UpdateAccount(ApiMsgHandler, customerAccounts[i], customerAccounts[i].Id); Assert.AreEqual(firstName, result.FirstName); //GetAccount var result1 = CustomerAccountFactory.GetAccount(ApiMsgHandler, customerAccounts[i].Id); Assert.AreEqual(firstName, result1.FirstName); Assert.AreEqual(2, result1.Contacts.Count); } }
public void CustomerUpdateAccount_company() { //CreateAccounts var customerAccounts = Generator.AddAccountsRandom(ApiMsgHandler, 15, 2); for (int i = 0; i < customerAccounts.Count; i++) { var company = Generator.RandomString(25, Generator.RandomCharacterGroup.AlphaNumericOnly); customerAccounts[i].CompanyOrOrganization = company; var result = CustomerAccountFactory.UpdateAccount(ApiMsgHandler, customerAccounts[i], customerAccounts[i].Id); Assert.AreEqual(company, result.CompanyOrOrganization); //GetAccount var result1 = CustomerAccountFactory.GetAccount(ApiMsgHandler, customerAccounts[i].Id); Assert.AreEqual(company, result1.CompanyOrOrganization); Assert.AreEqual(2, result1.Contacts.Count); } }
public void CustomerAccountFilterbyContactsEmail_sw() { //CreateAccounts var customerAccounts = Generator.AddAccountsRandom(ApiMsgHandler, 5, 5); for (int i = 0; i < customerAccounts.Count; i++) { var contacts = CustomerContactFactory.GetAccountContacts(ApiMsgHandler, customerAccounts[i].Id); Assert.AreEqual(5, contacts.TotalCount); for (int x = 0; x < contacts.TotalCount; x++) { var filterBy = "contacts.email sw " + contacts.Items[x].Email.Substring(0, 6); var result = CustomerAccountFactory.GetAccounts(ApiMsgHandler, 0, 3, null, filterBy); Assert.AreEqual(1, result.TotalCount); } } }
public void CustomerAccountFilterbyContactsLasttnameorsurname_eq() { //CreateAccounts var customerAccounts = Generator.AddAccountsRandom(ApiMsgHandler, 4, 8); for (int i = 0; i < customerAccounts.Count; i++) { var contacts = CustomerContactFactory.GetAccountContacts(ApiMsgHandler, customerAccounts[i].Id); Assert.AreEqual(8, contacts.TotalCount); for (int x = 0; x < contacts.TotalCount; x++) { var filterBy = "contacts.lastnameorsurname eq " + contacts.Items[x].LastNameOrSurname; var result = CustomerAccountFactory.GetAccounts(ApiMsgHandler, 0, 3, null, filterBy); Assert.AreEqual(1, result.TotalCount); } } }
public void CustomerAccountFilterbyContactsfirstname_cont() { //CreateAccounts var customerAccounts = Generator.AddAccountsRandom(ApiMsgHandler, 10, 3); for (int i = 0; i < customerAccounts.Count; i++) { var contacts = CustomerContactFactory.GetAccountContacts(ApiMsgHandler, customerAccounts[i].Id); Assert.AreEqual(3, contacts.TotalCount); for (int x = 0; x < contacts.TotalCount; x++) { var filterBy = "contacts.firstname cont " + contacts.Items[x].FirstName.Substring(1, 4); var result = CustomerAccountFactory.GetAccounts(ApiMsgHandler, 0, 3, null, filterBy); Assert.AreEqual(1, result.TotalCount); } } }
public void CustomerUpdateAccount_TaxId() { //CreateAccounts var customerAccounts = Generator.AddAccountsRandom(ApiMsgHandler, 8, 0); for (int i = 0; i < customerAccounts.Count; i++) { var taxId = Generator.RandomString(5, Generator.RandomCharacterGroup.AnyCharacter); customerAccounts[i].TaxExempt = true; customerAccounts[i].TaxId = taxId; var result = CustomerAccountFactory.UpdateAccount(ApiMsgHandler, customerAccounts[i], customerAccounts[i].Id); Assert.AreEqual(taxId, result.TaxId); //GetAccount var result1 = CustomerAccountFactory.GetAccount(ApiMsgHandler, customerAccounts[i].Id); Assert.AreEqual(taxId, result1.TaxId); Assert.AreEqual(0, result1.Contacts.Count); } }
public void CustomerUpdateAccountNote() { //CreateAccounts var customerAccounts = Generator.AddAccountsRandom(ApiMsgHandler, 8, 0); for (int i = 0; i < customerAccounts.Count; i++) { var note = Generator.GenerateCustomerNote(); var custNote = CustomerNoteFactory.AddAccountNote(ApiMsgHandler, note, customerAccounts[i].Id); //GetNote var result = CustomerNoteFactory.GetAccountNote(ApiMsgHandler, customerAccounts[i].Id, custNote.Id); Assert.AreEqual(note.Content, result.Content); //UpdateNote note.Content = Generator.RandomString(15, Generator.RandomCharacterGroup.AlphaNumericOnly); var updateNote = CustomerNoteFactory.UpdateAccountNote(ApiMsgHandler, note, customerAccounts[i].Id, custNote.Id); Assert.AreEqual(note.Content, updateNote.Content); //GetNote var result1 = CustomerNoteFactory.GetAccountNote(ApiMsgHandler, customerAccounts[i].Id, custNote.Id); Assert.AreEqual(note.Content, result1.Content); } }
public void CustomerAccountFilterbyContactsEmail_cont() { //CreateAccounts var customerAccounts = Generator.AddAccountsRandom(ApiMsgHandler, 5, 5); for (int i = 0; i < customerAccounts.Count; i++) { var contacts = CustomerContactFactory.GetAccountContacts(ApiMsgHandler, customerAccounts[i].Id); Assert.AreEqual(5, contacts.TotalCount); for (int x = 0; x < contacts.TotalCount; x++) { var split1 = contacts.Items[x].Email.Split('.'); var split2 = split1[0].Split('@'); var filterBy = "contacts.email cont " + split2[0].Substring(1, 4); var result = CustomerAccountFactory.GetAccounts(ApiMsgHandler, 0, 3, null, filterBy); Assert.AreEqual(1, result.TotalCount); filterBy = "contacts.email cont " + split2[1].Substring(2, 5); result = CustomerAccountFactory.GetAccounts(ApiMsgHandler, 0, 3, null, filterBy); Assert.AreEqual(1, result.TotalCount); } } }
public void CustomerAccountUpdateContact() { //CreateAccounts var customerAccounts = Generator.AddAccountsRandom(ApiMsgHandler, 2, 6); for (int i = 0; i < customerAccounts.Count; i++) { var contacts = CustomerContactFactory.GetAccountContacts(ApiMsgHandler, customerAccounts[i].Id); Assert.AreEqual(6, contacts.TotalCount); for (int x = 0; x < contacts.TotalCount; x++) { var contact = CustomerContactFactory.GetAccountContact(ApiMsgHandler, customerAccounts[i].Id, contacts.Items[x].Id); contact.FirstName = "newName"; contact.LastNameOrSurname = "latestName"; contact.Email = "myUpdated32Email.com"; CustomerContactFactory.UpdateAccountContact(ApiMsgHandler, contact, customerAccounts[i].Id, contact.Id); var result = CustomerContactFactory.GetAccountContact(ApiMsgHandler, customerAccounts[i].Id, contacts.Items[x].Id); Assert.AreEqual("newName".ToLower(), result.FirstName.ToLower()); Assert.AreEqual("latestName".ToLower(), result.LastNameOrSurname.ToLower()); Assert.AreEqual("myUpdated32Email.com".ToLower(), result.Email.ToLower()); } } }