[TestMethod()]//Negative test to Check if this method sets the respective thread status to false if thread name is null.
        public void ThreadProcessControllerGetThreadProcessStatus_ToCheckIfItSetsTheThreadStatusToFalse()
        {
            threadProcess = new ThreadProcessController();
            xmlReader     = XmlReader.Create(@"..\XMLTestFiles\TPA_500.xml");
            var tpa        = new TPAScaffold();
            var serializer = new XmlSerializer(tpa.GetType());

            input = (TPAScaffold)serializer.Deserialize(xmlReader);

            accountInfo    = new AccountInfo();
            accountInfo.ID = 206;


            //Act
            Thread PushWareHousLocThread = new Thread(() => tpaController.PushWareHouseLocation(input, accountInfo.ID));

            PushWareHousLocThread.Start();

            string tname = "";

            bool status = threadProcess.GetThreadProcessStatus(tname, accountInfo.ID);

            //Assert
            Assert.IsFalse(status, "Thread status must be false if thread name is null!!");
        }
        [TestInitialize]//Initializes data required for each test and runs once per test method.
        public void InitializeData()
        {
            //Arrange
            accountInfo = new AccountInfo();

            XmlReader xmlReader  = XmlReader.Create(@"..\XMLTestFiles\TPA_500.xml");
            var       tpa        = new TPAScaffold();
            var       serializer = new XmlSerializer(tpa.GetType());

            input = (TPAScaffold)serializer.Deserialize(xmlReader);

            tpaController = new TaxProfileAssistantController();
            tpaController.ControllerContext = new ControllerContext();
            string resultstr = tpaController.Post(input);
            string key       = resultstr.Substring(38);

            key         = key.Replace(Constants.APPLICATION_URL_DUMMY_TEXT, "/");
            accountInfo = AvaTaxProfileAssistantHelper.GetAccountInfoBySecureKey(key);

            nexusController = new NexusSetupController();
            accountService  = new AccountService(accountInfo.Webservice, accountInfo.UserName, accountInfo.Password, accountInfo.AccountNumber, accountInfo.LicenseKey, accountInfo.ERPName);
            TempData        = new TempDataDictionary();
            nexusController.TempData.Add("AccountInfo", accountInfo);
            nexusController.TempData.Add("AccountService", accountService);
        }
        [TestMethod()]//Checks if Index method returns existing companies view
        public void ExistingCompanyController_IndexTest_CheckIfItReturnsCorrectView()
        {
            //Arrange
            AccountInfo accountInfo = new AccountInfo();
            TPAScaffold input       = new TPAScaffold();
            TaxProfileAssistantController tpaController = new TaxProfileAssistantController();

            XmlReader xmlReader  = XmlReader.Create(@"..\XMLTestFiles\TPA_500.xml");
            var       tpa        = new TPAScaffold();
            var       serializer = new XmlSerializer(tpa.GetType());

            input = (TPAScaffold)serializer.Deserialize(xmlReader);

            tpaController.ControllerContext = new ControllerContext();
            string resultstr = tpaController.Post(input);
            string key       = resultstr.Substring(38);

            key         = key.Replace(Constants.APPLICATION_URL_DUMMY_TEXT, "/");
            accountInfo = AvaTaxProfileAssistantHelper.GetAccountInfoBySecureKey(key);

            ExistingCompanyController existingCompany = new ExistingCompanyController();
            TempDataDictionary        TempData        = new TempDataDictionary();

            existingCompany.TempData.Add("AccountInfo", accountInfo);

            //Act
            var result = existingCompany.Index() as ViewResult;

            //Assert: Checks if Company Information is returned
            Assert.IsTrue(result.TempData.Count > 0);
            Assert.IsInstanceOfType(result, typeof(ViewResult));
        }
コード例 #4
0
        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          = "";
        }
        [TestInitialize]//Initializes data required for each test and runs once per test method.
        public void InitializeData()
        {
            //Arrange

            avaSetupReportController = new AvaSetupReportController();
            XmlReader xmlReader  = XmlReader.Create(@"..\XMLTestFiles\TPA_500.xml");
            var       tpa        = new TPAScaffold();
            var       serializer = new XmlSerializer(tpa.GetType());

            input = (TPAScaffold)serializer.Deserialize(xmlReader);

            tpaController = new TaxProfileAssistantController();
            tpaController.ControllerContext = new ControllerContext();
            string resultstr = tpaController.Post(input);
            string key       = resultstr.Substring(38);

            key         = key.Replace(Constants.APPLICATION_URL_DUMMY_TEXT, "/");
            accountInfo = AvaTaxProfileAssistantHelper.GetAccountInfoBySecureKey(key);

            accountService = new AccountService(accountInfo.Webservice, accountInfo.UserName, accountInfo.Password, accountInfo.AccountNumber, accountInfo.LicenseKey, accountInfo.ERPName);


            TempDataDictionary TempData = new TempDataDictionary();

            avaSetupReportController.TempData.Add("AccountInfo", accountInfo);
            avaSetupReportController.TempData.Add("AccountService", accountService);
            Constants.SESSION_KEY_SELECTED_COMPANY = "4.1 Dev Company";
            avaSetupReportController.TempData.Add(Constants.SESSION_KEY_SELECTED_COMPANY, "4.1 Dev Company");
            avaSetupReportController.TempData.Add(TaxProfileAssistant.Utils.Constants.SESSION_KEY_ERP_NAME, accountInfo.ERPName);
            avaSetupReportController.TempData.Add(TaxProfileAssistant.Utils.Constants.SESSION_KEY_COMPANY_NAME, "Systems of America");
        }
        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);
        }
        [TestMethod()]//Checks performance of post method for 10000 records
        public void TaxProfileAssistantController_Post_XML_Load_TestFor10000Records()
        {
            XmlReader   xmlReader  = XmlReader.Create(@"..\XMLTestFiles\TPA_10000.xml");
            var         tpa        = new TPAScaffold();
            var         serializer = new XmlSerializer(tpa.GetType());
            TPAScaffold input      = (TPAScaffold)serializer.Deserialize(xmlReader);
            TaxProfileAssistantController tpaController = new TaxProfileAssistantController();

            tpaController.ControllerContext = new ControllerContext();
            string ReturnURL = tpaController.Post(input);

            Assert.IsNotNull(ReturnURL, "Problem in returning URL through post method!!Returned url is empty!");
        }
コード例 #8
0
        public AccountInfo InitializeTestData()
        {
            var         _temp      = System.Data.Entity.SqlServer.SqlProviderServices.Instance;
            XmlReader   xmlReader  = XmlReader.Create(@"..\XMLTestFiles\TPA_500.xml");
            var         tpa        = new TPAScaffold();
            var         serializer = new XmlSerializer(tpa.GetType());
            TPAScaffold input      = (TPAScaffold)serializer.Deserialize(xmlReader);
            TaxProfileAssistantController tpaController = new TaxProfileAssistantController();
            String      resultStr   = tpaController.Post(input);
            string      ID          = resultStr.Substring(38);
            AccountInfo accountInfo = AvaTaxProfileAssistantHelper.GetAccountInfoBySecureKey(ID);

            return(accountInfo);
        }
コード例 #9
0
        [TestInitialize]//Initializes data required for each test and runs once per test method.
        public void InitializeData()
        {
            //Arrange
            XmlReader xmlReader  = XmlReader.Create(@"..\XMLTestFiles\TPA_500.xml");
            var       tpa        = new TPAScaffold();
            var       serializer = new XmlSerializer(tpa.GetType());

            input          = (TPAScaffold)serializer.Deserialize(xmlReader);
            homeController = new HomepageController();
            tpaController  = new TaxProfileAssistantController();
            tpaController.ControllerContext = new ControllerContext();

            IsConnected       = false;
            IsChoseCompany    = false;
            WhereToCollectTax = false;
            NexusWarning      = false;
        }
        [TestMethod()]//check modelstate and if false return errorstring
        public void GetValidationErrorMessagesTestForInvalidModel()
        {
            //Arrange
            xmlReader = XmlReader.Create(@"..\XMLTestFiles\TPA_1000_AccountCredentialsMissing.xml");
            var tpa        = new TPAScaffold();
            var serializer = new XmlSerializer(tpa.GetType());

            input = (TPAScaffold)serializer.Deserialize(xmlReader);
            AvaTaxProfileAssistantHelperTests taxProfileAsstHelper = new AvaTaxProfileAssistantHelperTests();

            TryValidateModel(input.AccountCredentials);
            string ErrorString = "";

            //Act
            AvaTaxProfileAssistantHelper.GetValidationErrorMessages(ModelState, ref ErrorString);

            //Assert
            Assert.AreEqual(false, ModelState.IsValid, "Model state cannot be true when invalid credentials are passed!!");
        }
コード例 #11
0
        [TestInitialize]//Initializes data required for each test and runs once per test method.
        public void InitializeData()
        {
            //Arrange
            accountInfo = new AccountInfo();

            xmlReader = XmlReader.Create(@"..\XMLTestFiles\TPA_500.xml");
            var tpa        = new TPAScaffold();
            var serializer = new XmlSerializer(tpa.GetType());

            input = (TPAScaffold)serializer.Deserialize(xmlReader);

            tpaController = new TaxProfileAssistantController();
            tpaController.ControllerContext = new ControllerContext();
            string resultstr = tpaController.Post(input);
            string key       = resultstr.Substring(38);

            key         = key.Replace(Constants.APPLICATION_URL_DUMMY_TEXT, "/");
            accountInfo = AvaTaxProfileAssistantHelper.GetAccountInfoBySecureKey(key);
        }
コード例 #12
0
        [TestMethod]//Checks if index method of homecontroller works with 2000 records
        public void HomeController_IndexTestWithXMLOf2000Records()
        {
            //Arrange

            XmlReader   xmlReader  = XmlReader.Create(@"..\XMLTestFiles\TPA_2000.xml");
            var         tpa        = new TPAScaffold();
            var         serializer = new XmlSerializer(tpa.GetType());
            TPAScaffold input      = (TPAScaffold)serializer.Deserialize(xmlReader);

            //Act
            string returnURL = tpaController.Post(input);
            string ID        = returnURL.Substring(38);
            var    result    = homeController.Index(ID) as ViewResult;
            var    homepage  = (HomepageInfo)result.ViewData.Model;


            //Assert
            Assert.IsTrue(homepage.IsConnected, "Load test of 2000 records failed!!Service not connected!");
        }
        [TestMethod]//Checks if Post method returns url if correct xml is provided
        public void PostMethod_ReturnURL_Test()
        {
            //Arrange
            //var _temp = System.Data.Entity.SqlServer.SqlProviderServices.Instance;

            XmlReader   xmlReader  = XmlReader.Create(@"..\XMLTestFiles\TPA_500.xml");
            var         tpa        = new TPAScaffold();
            var         serializer = new XmlSerializer(tpa.GetType());
            TPAScaffold input      = (TPAScaffold)serializer.Deserialize(xmlReader);
            TaxProfileAssistantController tpaController = new TaxProfileAssistantController();

            tpaController.ControllerContext = new ControllerContext();

            //Act
            String resultStr = tpaController.Post(input);

            //Assert

            Assert.IsNotNull(resultStr, "Problem in returning url through post!!Returned url is empty!");
        }
        [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!!");
            }
        }
コード例 #15
0
        [TestMethod()]//Test working of decrypt function in CryptoGrapher
        public void DecryptTest()
        {
            //Arrange
            xmlReader = XmlReader.Create(@"..\XMLTestFiles\TPA_500.xml");
            var tpa        = new TPAScaffold();
            var serializer = new XmlSerializer(tpa.GetType());

            input = (TPAScaffold)serializer.Deserialize(xmlReader);
            crypt = new CryptoGrapher();

            tpaController = new TaxProfileAssistantController();
            tpaController.ControllerContext = new ControllerContext();
            string resultstr = tpaController.Post(input);
            string key       = resultstr.Substring(38);

            key = key.Replace(Constants.APPLICATION_URL_DUMMY_TEXT, "/");

            //Act
            string DecryptedKey = crypt.Decrypt(key);

            //Assert
            Assert.AreNotEqual(key, DecryptedKey);
        }
        [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!!");
        }
        [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!!");
        }