[TestMethod()]//Check if it returns a list of NexusMaster. public void GetNexusesTestToCheckIfItReturnsNexusMaster() { //Arrange var AccountInfo = AvaTaxProfileAssistantHelper.InsertAccountInfo(input.AccountCredentials); int TotCntCmpLoc = input.Nexus.CompanyLocations.Count(); bool SaveNow = false; //Act for (int i = 0; i < TotCntCmpLoc; i++) { if (i % 500 == 0 || i == (TotCntCmpLoc - 1)) { SaveNow = true; } else { SaveNow = false; } AvaTaxProfileAssistantHelper.InsertNexusCompanyLocation(input.Nexus.CompanyLocations[i], AccountInfo.ID); AvaTaxProfileAssistantHelper.InsertNexusWareHourseLocation(input.Nexus.WareHouseLocations[i], AccountInfo.ID); AvaTaxProfileAssistantHelper.InsertNexusPreviousCustomerLocation(input.Nexus.PreviousCustomerLocations[i], AccountInfo.ID); } var result = AvaTaxProfileAssistantHelper.GetNexuses(AccountInfo.ID); //Assert Assert.IsInstanceOfType(result, typeof(List <NexusMaster>), "Incorrect result type returned!!"); }
public void InitializeData() { xmlReader = XmlReader.Create(@"..\XMLTestFiles\TPA_500.xml"); var tpa = new TPAScaffold(); var serializer = new XmlSerializer(tpa.GetType()); input = (TPAScaffold)serializer.Deserialize(xmlReader); accountInfo = AvaTaxProfileAssistantHelper.InsertAccountInfo(input.AccountCredentials); accountService = new AccountService(accountInfo.Webservice, accountInfo.UserName, accountInfo.Password, accountInfo.AccountNumber, accountInfo.LicenseKey, accountInfo.ERPName); createCompanyController = new CreateCompanyController(); createCompanyController.TempData.Add("AccountInfo", accountInfo); createCompanyController.TempData.Add("AccountService", accountService); createCompany = new CreateCompany(); createCompany.AccountInfoID = accountInfo.ID; createCompany.AddressLine1 = "900 winslow way e"; createCompany.AddressLine2 = ""; createCompany.AddressLine3 = ""; createCompany.CompanyCode = Guid.NewGuid().ToString().Substring(0, 8); createCompany.CompanyName = "Systems of America1"; createCompany.Country = "US"; createCompany.StateProvince = "WA"; createCompany.TIN = "95-3657472"; createCompany.FirstName = "abbott"; createCompany.LastName = "abbott"; createCompany.PhoneNumber = "9999999999"; createCompany.Fax = "9999999999"; createCompany.Email = "*****@*****.**"; createCompany.City = "Bainbridge Island"; createCompany.ZipCode = "98110"; createCompany.MobileNumber = ""; createCompany.Title = ""; createCompany.BIN = ""; }
[TestMethod()]//Checks if correct type of result is returned. public void InsertAccountInfoTestToCheckReturnType() { //Act var result = AvaTaxProfileAssistantHelper.InsertAccountInfo(input.AccountCredentials); //Assert Assert.IsInstanceOfType(result, typeof(AccountInfo), "Incorrect type of result returned! "); }
[TestMethod()]//Check if newly cretaed company info are being inserted in the database from xml. public void InsertCreateCompanyInfoTestToCheckCompanyInfoInsertionInDatabase() { //Act var accinfo = AvaTaxProfileAssistantHelper.InsertAccountInfo(input.AccountCredentials); var CompanyInfo = AvaTaxProfileAssistantHelper.InsertCreateCompanyInfo(input.Company, accinfo.ID); //Assert Assert.AreEqual(true, CompanyInfo, "Company info insertion in database failed!!"); }
[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 it returns a list of customers. public void GetCustomersListTestToCheckIfItReturnsListOfCustomers() { //Arrange var AccountInfo = AvaTaxProfileAssistantHelper.InsertAccountInfo(input.AccountCredentials); //Act var actualResult = AvaTaxProfileAssistantHelper.GetCustomersList(AccountInfo.ID); //Assert Assert.IsInstanceOfType(actualResult, typeof(List <Customers>), "Incorrect result type returned!!"); }
[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 the correct Company Info details. public void GetCreateCompanyInfoTestToCheckIfCorrectCompanyDetailsAreReturned() { //Act var AccountInfo = AvaTaxProfileAssistantHelper.InsertAccountInfo(input.AccountCredentials); var InsertCompanyInfo = AvaTaxProfileAssistantHelper.InsertCreateCompanyInfo(input.Company, AccountInfo.ID); var CompanyInfo = AvaTaxProfileAssistantHelper.GetCreateCompanyInfo(AccountInfo.ID); //Assert Assert.AreEqual(input.Company.TIN, CompanyInfo.TIN, "Incorrect TIN!!"); Assert.AreEqual(input.Company.CompanyName, CompanyInfo.CompanyName, "Incorrect Company name!!"); }
[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 a list of HelpLinks. public void GetLinkListTestToCheckIfItReturnsListOfHelpLinks() { //Arrange var accinfo = AvaTaxProfileAssistantHelper.InsertAccountInfo(input.AccountCredentials); //Act var actualresult = AvaTaxProfileAssistantHelper.GetLinkList(accinfo.ID); List <HelpLink> expectedresult = new List <HelpLink>(); //Assert Assert.AreEqual(expectedresult.GetType(), actualresult.GetType(), "The method failed to return a list of helplinks!!"); Assert.IsNotNull(actualresult, "The list does not contain any records!!"); }
[TestMethod()]//Check if the help links are being inserted in the database from xml. public void InsertHelpLinkTestToCheckInsertionOfHelpLinksInDatabase() { //Act var accinfo = AvaTaxProfileAssistantHelper.InsertAccountInfo(input.AccountCredentials); foreach (Link hl in input.HelpLink.Links) { var actualresult = AvaTaxProfileAssistantHelper.InsertHelpLink(hl, accinfo.ID); //Assert Assert.AreEqual(true, actualresult, "HelpLink insertion in database failed!!"); } }
[TestMethod()]//Checks if data is inserted in database. public void InsertAccountInfoTestToCheckInsertionOfRecordInDatabase() { //Act var actualresult = AvaTaxProfileAssistantHelper.InsertAccountInfo(input.AccountCredentials); var expectedresult = AvaTaxProfileAssistantHelper.GetAccountInfo(actualresult.ID); //Assert Assert.AreEqual(expectedresult.ID, actualresult.ID, "Insertion of account information in database failed!!Incorrect Account ID!"); Assert.AreEqual(expectedresult.AccountNumber, actualresult.AccountNumber, "Insertion of account information in database failed!!Incorrect AccountNumber!"); Assert.AreEqual(expectedresult.UserName, actualresult.UserName, "Insertion of account information in database failed!!Incorrect Username!"); Assert.AreEqual(expectedresult.Password, actualresult.Password, "Insertion of account information in database failed!!Incorrect Password!"); Assert.AreEqual(expectedresult.LicenseKey, actualresult.LicenseKey, "Insertion of account information in database failed!!Incorrect License key!"); Assert.AreEqual(expectedresult.CompanyCode, actualresult.CompanyCode, "Insertion of account information in database failed!!Incorrect Company Code!"); Assert.AreEqual(expectedresult.Webservice, actualresult.Webservice, "Insertion of account information in database failed!!Incorrect WebService!"); }
[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!!"); }