Пример #1
0
        public void HttpDataAccessTest_WebLogin_And_WebLogout()
        {
            string server = testContextInstance.DataRow["Server"].ToString();
            string login = testContextInstance.DataRow["Login"].ToString();
            string password = testContextInstance.DataRow["Password"].ToString();
            string exception = string.Empty;
            bool shouldPass = bool.Parse(testContextInstance.DataRow["ShouldPass"].ToString());
            HttpDataClient test = new HttpDataClient();

            bool passed = false;
            try
            {
                test.Login(server, login, password);

                test.WebLogin();
                test.WebLogout();

                passed = true;
            }
            catch (Exception ex) { exception = ex.Message; }

            Assert.AreEqual(passed, shouldPass, string.Format("server:{1}{0}login:{2}{0}password:{3}{0}shouldpass:{4}{0}passed:{5}{0}exception:{6}", Environment.NewLine, server, login, password, shouldPass, passed, exception));
        }
Пример #2
0
        public void HttpDataAccessTest_Upload_File_To_Queue()
        {
            string server = testContextInstance.DataRow["Server"].ToString();
            string login = testContextInstance.DataRow["Login"].ToString();
            string password = testContextInstance.DataRow["Password"].ToString();
            string filePath = testContextInstance.DataRow["FilePath"].ToString();
            int operatorId = int.Parse(testContextInstance.DataRow["OperatorId"].ToString());
            bool shouldPass = bool.Parse(testContextInstance.DataRow["ShouldPass"].ToString());
            string exception = string.Empty;
            HttpDataClient test = new HttpDataClient();

            bool passed = false;
            try
            {
                test.Login(server, login, password);
                test.WebLogin();
                try
                {
                    test.UploadFileToQueue(new HttpDataAccessQueueParameters()
                    {
                        FilePath = filePath,
                        Activate = false,
                        CoordinatesApproved = false,
                        OperatorID = operatorId,
                        Timeout = 100,
                        UseQueue = true
                    });
                }
                finally
                {
                    test.WebLogout();
                }

                passed = true;
            }
            catch (Exception ex) { exception = ex.Message; }

            Assert.AreEqual(passed, shouldPass, string.Format("server:{1}{0}login:{2}{0}password:{3}{0}operatorid:{4}{0}filepath:{5}{0}shouldpass:{6}{0}passed:{7}{0}exception:{8}", Environment.NewLine, server, login, password, operatorId, filePath, shouldPass, passed, exception));
        }