Last active
December 16, 2015 23:13
-
-
Save Mozu-CS/8957e5af219dee848f2c to your computer and use it in GitHub Desktop.
A unit test that displays the various customer import methods at work
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[TestMethod] | |
public void Add_Customer_Accounts_Test() | |
{ | |
var tblAccounts = GetAccountTestData(); | |
var tblContacts = GetContactTestData(); | |
var accountAndAuths = new List<Mozu.Api.Contracts.Customer.CustomerAccountAndAuthInfo>(); | |
foreach(System.Data.DataRow drAcct in tblAccounts.Rows) | |
{ | |
var customerLoginInfo = MapCustomerLoginInfo(drAcct); | |
var account = MapCustomerAccount(drAcct); | |
System.Data.DataRow[] drContacts = tblContacts.Select(string.Format("Id = '{0}'", drAcct["Id"].ToString())); | |
account.Contacts = new List<Mozu.Api.Contracts.Customer.CustomerContact>(); | |
foreach(System.Data.DataRow drContact in drContacts) | |
{ | |
var contact = MapCustomerContact(drContact); | |
account.Contacts.Add(contact); | |
} | |
accountAndAuths.Add(new Mozu.Api.Contracts.Customer.CustomerAccountAndAuthInfo() | |
{ | |
Account = account, | |
IsImport = Convert.ToBoolean(customerLoginInfo.IsImport), | |
Password = customerLoginInfo.Password | |
}); | |
} | |
var importedAcctIds = ImportCustomers(accountAndAuths); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment