Esempio n. 1
0
        public void doPost()
        {
            Assert.AreEqual("utf-8", Encoding.UTF8.HeaderName);
            Assert.AreEqual(Encoding.UTF8, Encoding.GetEncoding(Encoding.UTF8.HeaderName));
            Encoding e = Encoding.GetEncoding("Windows-1251");
            var      p = new PHP_SMS();

            p.Vars["sn"]       = "1";
            p.Vars["num"]      = "<br>";
            p.Vars["sms_text"] = "Привет";
            p.URL      = "http://www.i-rai.com:83/test.php";
            p.Encoding = Encoding.UTF8;
            Assert.AreEqual("Привет мир!  sn = 1  num = " + p.Vars["num"] + "  sms_text = " + p.Vars["sms_text"],
                            p.doPost());

            // Испытываем скрипт index.php в кодировке Windows-1251
            var p1 = PHP_SMS.Get_by_Prefix("index");

            Assert.AreEqual("Привет, мир! Windows-1251 sn = 4141  num = 79117117850  sms_text = " + "Привет",
                            MessageProcessing.GetAnswer(p1, "4141", "Привет", "79117117850"));

            PHP_SMS pp = PHP_SMS.Get_by_Prefix("supsex");
            // Assert.IsTrue(MessageProcessing.GetAnswer(pp, "4141", "test", "79117117850").StartsWith("Пароль: "));
            //  Assert.AreEqual("", MessageProcessing.GetAnswer(pp, "4141", "test", "79117117850"));

            PHP_SMS p2 = PHP_SMS.Get_by_Prefix("test");

            //    Assert.AreEqual("", MessageProcessing.GetAnswer(p2, "4141", "test", "79117117850"));
            Assert.IsTrue(MessageProcessing.GetAnswer(p2, "4141", "test", "79117117850").StartsWith("\nhttp://test.i-rai.com/psi1.php?pass="));
        }
Esempio n. 2
0
    public void doPost() {
      Assert.AreEqual("utf-8", Encoding.UTF8.HeaderName);
      Assert.AreEqual(Encoding.UTF8, Encoding.GetEncoding(Encoding.UTF8.HeaderName));
      Encoding e = Encoding.GetEncoding("Windows-1251");
      var p = new PHP_SMS();
      p.Vars["sn"] = "1";
      p.Vars["num"] = "<br>";
      p.Vars["sms_text"] = "Привет";
      p.URL = "http://www.i-rai.com:83/test.php";
      p.Encoding = Encoding.UTF8;
      Assert.AreEqual("Привет мир!  sn = 1  num = " + p.Vars["num"] + "  sms_text = " + p.Vars["sms_text"],
                      p.doPost());

      // Испытываем скрипт index.php в кодировке Windows-1251
      var p1 = PHP_SMS.Get_by_Prefix("index");
      Assert.AreEqual("Привет, мир! Windows-1251 sn = 4141  num = 79117117850  sms_text = " + "Привет", 
        MessageProcessing.GetAnswer(p1, "4141", "Привет", "79117117850"));

      PHP_SMS pp = PHP_SMS.Get_by_Prefix("supsex");
      // Assert.IsTrue(MessageProcessing.GetAnswer(pp, "4141", "test", "79117117850").StartsWith("Пароль: "));
    //  Assert.AreEqual("", MessageProcessing.GetAnswer(pp, "4141", "test", "79117117850"));

      PHP_SMS p2 = PHP_SMS.Get_by_Prefix("test");
  //    Assert.AreEqual("", MessageProcessing.GetAnswer(p2, "4141", "test", "79117117850"));
      Assert.IsTrue(MessageProcessing.GetAnswer(p2, "4141", "test", "79117117850").StartsWith("\nhttp://test.i-rai.com/psi1.php?pass="));

    }
Esempio n. 3
0
        public void doPostTest()
        {
            System.DateTime methodStartTime = System.DateTime.Now;
            string          expected        = "test";
            string          results;

            //Parameters

            results = _phpSms.doPost();
            Assert.AreEqual(expected, results, "MPS.PHP_SMS.doPost method test failed");

            System.TimeSpan methodDuration = System.DateTime.Now.Subtract(methodStartTime);
            System.Console.WriteLine(String.Format("MPS.PHP_SMS.doPost Time Elapsed: {0}", methodDuration.ToString()));
        }