[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));
        }
        [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");
        }
        [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!");
        }
コード例 #5
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);
        }
コード例 #6
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;
        }
コード例 #7
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);
        }
        [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 it returns the correct accountInfo details.
        public void GetAccountInfoBySecureKeyTestToCheckIfCorrectAccountInfoDetailsAreFetched()
        {
            //Arrange
            TaxProfileAssistantController 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
            AccountInfo accInfo = AvaTaxProfileAssistantHelper.GetAccountInfoBySecureKey(key);

            //Assert
            Assert.AreEqual(input.AccountCredentials.AccountNumber, accInfo.AccountNumber, "Incorrect AccountNumber returned!!");
            Assert.AreEqual(input.AccountCredentials.UserName, accInfo.UserName, "Incorrect UserName returned!!");
            Assert.AreEqual(input.AccountCredentials.Password, accInfo.Password, "Incorrect Password returned!!");
            Assert.AreEqual(input.AccountCredentials.LicenseKey, accInfo.LicenseKey, "Incorrect LicenseKey returned!!");
        }
コード例 #10
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);
        }