[TestMethod()]//Check if the method successfully inserts customer records in database public void InsertCustomersTestToCheckInsertionOfCustomerRecordsInDatabase() { //Arrange xmlReader = XmlReader.Create(@"..\XMLTestFiles\TPA_New.xml"); var tpa = new TPAScaffold(); var serializer = new XmlSerializer(tpa.GetType()); input = (TPAScaffold)serializer.Deserialize(xmlReader); var AccountInfo = AvaTaxProfileAssistantHelper.InsertAccountInfo(input.AccountCredentials); var AvaERPSetting = AvaTaxProfileAssistantHelper.InsertAvaERPSetting(input.AvaERPSettings, AccountInfo.ID); //Act foreach (AvaCustomer cust in input.AvaERPSettings.Customers) { var actualResult = AvaTaxProfileAssistantHelper.InsertCustomers(cust, AccountInfo.ID, AvaERPSetting); //Assert Assert.AreEqual(true, actualResult, "Customer Insertion failed!!"); } }
[TestMethod()]//Check if it returns correct number of customers as inserted from xml. public void GetCustomersListTestToCheckIfItReturnsCorrectNumberOfCustomers() { //Arrange xmlReader = XmlReader.Create(@"..\XMLTestFiles\TPA_New.xml"); var tpa = new TPAScaffold(); var serializer = new XmlSerializer(tpa.GetType()); input = (TPAScaffold)serializer.Deserialize(xmlReader); var AccountInfo = AvaTaxProfileAssistantHelper.InsertAccountInfo(input.AccountCredentials); var AvaERPSetting = AvaTaxProfileAssistantHelper.InsertAvaERPSetting(input.AvaERPSettings, AccountInfo.ID); //Act foreach (AvaCustomer cust in input.AvaERPSettings.Customers) { var actualResult = AvaTaxProfileAssistantHelper.InsertCustomers(cust, AccountInfo.ID, AvaERPSetting); } var Result = AvaTaxProfileAssistantHelper.GetCustomersList(AccountInfo.ID); Assert.AreEqual(Result.Count, input.AvaERPSettings.Customers.Count, "Incorrect number of customers returned!!"); }