[TestMethod()]//Check if AvaErpSettings are being inserted in database public void InsertAvaERPSettingTestToCheckInsertionOfAvaERPSettingsInDatabase() { //Act var AccountInfo = AvaTaxProfileAssistantHelper.InsertAccountInfo(input.AccountCredentials); var AvaERPSetting = AvaTaxProfileAssistantHelper.InsertAvaERPSetting(input.AvaERPSettings, AccountInfo.ID); //Assert Assert.IsNotNull(AvaERPSetting, "No records inserted!!"); }
[TestMethod()]//Check if AvaErpSettingsID returned matches the one in database. public void InsertAvaERPSettingTestToCheckCorrectAvaERPSettingsIDReturned() { //Act var AccountInfo = AvaTaxProfileAssistantHelper.InsertAccountInfo(input.AccountCredentials); var AvaERPSetting = AvaTaxProfileAssistantHelper.InsertAvaERPSetting(input.AvaERPSettings, AccountInfo.ID); var expectedID = AvaTaxProfileAssistantHelper.GetAvaERPSettingMaster(AccountInfo.ID); //Assert Assert.AreEqual(expectedID.ID, AvaERPSetting, "The inserted and fetched ID does not match!!"); }
[TestMethod()]//Check if it returns a AvaERPSettingMaster public void GetAvaERPSettingMasterTestToCheckIfItReturnsAvaERPSettingMaster() { //Arrange var AccountInfo = AvaTaxProfileAssistantHelper.InsertAccountInfo(input.AccountCredentials); var AvaERPSetting = AvaTaxProfileAssistantHelper.InsertAvaERPSetting(input.AvaERPSettings, AccountInfo.ID); //Act var result = AvaTaxProfileAssistantHelper.GetAvaERPSettingMaster(AccountInfo.ID); //Assert Assert.IsInstanceOfType(result, typeof(AvaERPSettingsMaster), "Incorrect result type returned!!"); }
[TestMethod()]//Check if the method returns correct number of mapped countries public void GetAvaERPCountryMappingTestToCheckIfItReturnsCorrectNumberOfMappedCountries() { //Arrange var AccountInfo = AvaTaxProfileAssistantHelper.InsertAccountInfo(input.AccountCredentials); int AvaERPSettingsID = AvaTaxProfileAssistantHelper.InsertAvaERPSetting(input.AvaERPSettings, AccountInfo.ID); //Act foreach (MappedCountry mc in input.AvaERPSettings.AddressValidation.MappedCountries) { AvaTaxProfileAssistantHelper.InsertAvaERPCountryMapping(AccountInfo.ID, AvaERPSettingsID, mc); } var result = AvaTaxProfileAssistantHelper.GetAvaERPCountryMapping(AccountInfo.ID); //Assert Assert.AreEqual(input.AvaERPSettings.AddressValidation.MappedCountries.Count, result.Count, "Incorrect number of mapped countries fetched!"); }
[TestMethod()]//Check if the method does not return an empty result public void GetAvaERPCountryMappingTestToCheckIfItDoesNotReturnEmptyResult() { //Arrange var AccountInfo = AvaTaxProfileAssistantHelper.InsertAccountInfo(input.AccountCredentials); int AvaERPSettingsID = AvaTaxProfileAssistantHelper.InsertAvaERPSetting(input.AvaERPSettings, AccountInfo.ID); //Act foreach (MappedCountry mc in input.AvaERPSettings.AddressValidation.MappedCountries) { AvaTaxProfileAssistantHelper.InsertAvaERPCountryMapping(AccountInfo.ID, AvaERPSettingsID, mc); } var result = AvaTaxProfileAssistantHelper.GetAvaERPCountryMapping(AccountInfo.ID); //Assert Assert.IsNotNull(result, "Empty result returned!!"); }
[TestMethod()]//Check if it returns a list of type AvaERPCountryMapping public void GetAvaERPCountryMappingTestToCheckIfItReturnsListOfAvaERPCountryMapping() { //Arrange var AccountInfo = AvaTaxProfileAssistantHelper.InsertAccountInfo(input.AccountCredentials); int AvaERPSettingsID = AvaTaxProfileAssistantHelper.InsertAvaERPSetting(input.AvaERPSettings, AccountInfo.ID); //Act foreach (MappedCountry mc in input.AvaERPSettings.AddressValidation.MappedCountries) { AvaTaxProfileAssistantHelper.InsertAvaERPCountryMapping(AccountInfo.ID, AvaERPSettingsID, mc); } var result = AvaTaxProfileAssistantHelper.GetAvaERPCountryMapping(AccountInfo.ID); //Assert Assert.IsInstanceOfType(result, typeof(List <AvaERPCountryMapping>), "Incorrect result type returned!!"); }
[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 a list of AvaERPSettingsOtherDetails. public void GetAvaERPSettingOtherDetailsTestToCheckReturnType() { 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); int AvaERPSettingsID = AvaTaxProfileAssistantHelper.InsertAvaERPSetting(input.AvaERPSettings, AccountInfo.ID); //Act foreach (EntityNameCode ec in input.AvaERPSettings.MapItemCodes.NonTaxableItems.Items) { AvaTaxProfileAssistantHelper.InsertEntityNameCode(AccountInfo.ID, AvaERPSettingsID, ec, Constants.AVAERP_SETTINGS_ITEMS); } var result = AvaTaxProfileAssistantHelper.GetAvaERPSettingOtherDetails(AccountInfo.ID); //Assert Assert.IsInstanceOfType(result, typeof(List <AvaERPSettingsOtherDetails>), "Incorrect result type returned!!"); }
[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!!"); }