Beispiel #1
0
        // Проверка пути первого запроса
        public void TestMethodConection()
        {
            Internet     a = new Internet();
            StreamReader DataReader;

            DataReader = a.Conection(1, 0, "eurusd");
            string response = DataReader.ReadToEnd();

            Assert.AreEqual(response.Trim(), "1454702997,1.1135,1.1138");
            DataReader = a.Conection(1, 1454702997, "eurusd");
            response   = DataReader.ReadToEnd();
            Assert.AreEqual(response.Trim(), "1454703008,1.1136,1.1139");
            DataReader = a.Conection(10, 1454702997, "eurusd");
            response   = DataReader.ReadToEnd();
            Assert.AreEqual(response.Trim(), "1454703008,1.1136,1.1139;1454703893,1.1134,1.1137;1454703916,1.1134,1.1137;1454703932,1.1133,1.1136;1454703942,1.1132,1.1135;1454703966,1.1131,1.1134;1454703967,1.1131,1.1134;1454703971,1.1132,1.1135;1454703973,1.1131,1.1134;1454703981,1.1131,1.1134");
            DataReader = a.Conection(1, 1454703981, "eurusd");
            response   = DataReader.ReadToEnd();
            Assert.AreEqual(response.Trim(), "1454703984,1.1132,1.1135");
            DataReader = a.Conection(1, 0, "usdjpy");
            response   = DataReader.ReadToEnd();
            Assert.AreEqual(response.Trim(), "1463788765,110.11,110.14");
            // выдача ошибки
            DataReader = a.Conection(1, 0, "jkhjk");
            response   = DataReader.ReadToEnd();
            Assert.AreEqual(response.Trim(), "4");
        }