Пример #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="));
        }
Пример #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="));

    }
Пример #3
0
 public void find_by_Prefix()
 {
     Assert.AreEqual("http://www.i-rai.com:83/test.php", PHP_SMS.Get_by_Prefix("test_denis").URL);
     Assert.AreEqual("http://supsex.ru/get_sms.php", PHP_SMS.Get_by_Prefix("supsex").URL);
     Assert.AreEqual("http://supsex.ru/get_sms.php", PHP_SMS.Get_by_Prefix("Supsex").URL);
     Assert.AreEqual("http://supsex.ru/get_sms.php", PHP_SMS.Get_by_Prefix("SUPSEX").URL);
     Assert.AreEqual("http://test.i-rai.com/get_sms.php", PHP_SMS.Get_by_Prefix("test").URL);
     Assert.IsNull(PHP_SMS.Get_by_Prefix("Несуществующий_префикс"));
 }
Пример #4
0
 public void get_Prefix()
 {
     Assert.AreEqual("AA", PHP_SMS.Get_Prefix("AA 1"));
     Assert.AreEqual("AB", PHP_SMS.Get_Prefix("AB"));
     Assert.AreEqual("BB", PHP_SMS.Get_Prefix(" BB\t\r\n2"));
     Assert.AreEqual("BB", PHP_SMS.Get_Prefix("\tBB\t\r\n2"));
     Assert.AreEqual("", PHP_SMS.Get_Prefix(""));
     Assert.AreEqual("", PHP_SMS.Get_Prefix("   "));
     Assert.AreEqual("", PHP_SMS.Get_Prefix(" \r\n  \t  "));
 }
Пример #5
0
        public void PHP_SMSConstructorTest()
        {
            System.DateTime constructorStartTime = System.DateTime.Now;

            //Parameters
            string prefix = "test";

            PHP_SMS phpSms = new PHP_SMS(prefix);

            Assert.AreEqual(String.Empty, String.Empty, "MPS.PHP_SMS.PHP_SMSConstructor constructor test failed");

            System.TimeSpan constructorDuration = System.DateTime.Now.Subtract(constructorStartTime);
            System.Console.WriteLine(String.Format("MPS.PHP_SMS.PHP_SMSConstructor Time Elapsed: {0}", constructorDuration.ToString()));
        }
Пример #6
0
        public void Get_PrefixTest()
        {
            System.DateTime methodStartTime = System.DateTime.Now;
            string          expected        = "test";
            string          results;

            //Parameters
            string smsText = "test";

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

            System.TimeSpan methodDuration = System.DateTime.Now.Subtract(methodStartTime);
            System.Console.WriteLine(String.Format("MPS.PHP_SMS.Get_Prefix Time Elapsed: {0}", methodDuration.ToString()));
        }
Пример #7
0
 public void Initialize()
 {
     //New instance of PHP SMS
     _phpSms = new PHP_SMS("test");
 }