Exemple #1
0
 public void checkPingPong(JObject message)
 {
     if (message?["ping"]?.ToString() == "0")
     {
         IdVObject obj = new IdVObject();
         obj.id      = "RP5-00-(000)";
         obj.version = "5.6.2.83";
         SendMessageToServer(obj);
     }
 }
Exemple #2
0
        public void CheckConnectionFirstMessageError()
        {
            adapter.ConnectTeacher();
            IdVObject obj = new IdVObject();

            obj.id      = "NEgativeGUID";
            obj.version = "5.6.2.83";
            adapter.SendMessageToServer(obj);
            JObject mes = adapter.RecieveMessage();

            Assert.AreEqual("NEgativeGUID", mes?["id"]?.Value <string>());
        }
Exemple #3
0
        public void CheckConnectionThirdMessage()
        {
            //Проверка третьего сообщения сервера
            adapter.ConnectTeacher();
            IdVObject obj = new IdVObject();

            obj.id      = "RP5-00-(000)";
            obj.version = "5.6.2.83";
            adapter.SendMessageToServer(obj);
            JObject mes = adapter.RecieveAwaytingMessage("client_disconn", "100");

            Assert.AreEqual("RP5-00-(000)", mes?["id"]?.Value <string>());
        }
Exemple #4
0
        public void CheckConnectionFirstMessage()
        {
            //Проверка первого сообщения сервера
            adapter.ConnectTeacher();
            IdVObject obj = new IdVObject();

            obj.id      = "RP5-00-(000)";
            obj.version = "5.6.2.83";
            adapter.SendMessageToServer(obj);
            JObject mes = adapter.RecieveMessage();

            Assert.AreEqual("0", mes?["exercise_id"]?.Value <string>());
            Assert.AreEqual("RP5-00-(000)", mes?["id"]?.Value <string>());
            Assert.AreEqual("5.6.2.6487.1119", mes?["version"]?.Value <string>());
        }
Exemple #5
0
        public void TestPingPong()
        {
            //Проверка пинга глубиной в 10
            adapter.ConnectTeacher();
            IdVObject obj = new IdVObject();

            obj.id      = "RP5-00-(000)";
            obj.version = "5.6.2.83";
            adapter.SendMessageToServer(obj);
            for (int i = 0; i < 10; i++)
            {
                while (true)
                {
                    JObject response = adapter.RecieveMessage();
                    if (response?["ping"]?.ToString() == "0")
                    {
                        adapter.checkPingPong(response);
                        break;
                    }
                }
            }
            Assert.True(true);
        }