Пример #1
0
 public string GetResult(TestApClient cl)
 {
     if (!_expected.ContainsKey(cl.Name))
     {
         Load(cl.Name);
     }
     if (_expected[cl.Name].Count > _last_res[cl.Name])
     {
         return(_expected[cl.Name][_last_res[cl.Name]].Replace("\\\"", "\""));
     }
     else
     {
         while (_expected[cl.Name].Count <= _last_res[cl.Name])
         {
             _expected[cl.Name].Add("");
         }
         return(_expected[cl.Name][_last_res[cl.Name]]);
     }
 }
        protected void SendSQLQuery(TestApClient cl, string query, TestData expected)
        {
            var res = cl.SendQuery(query);

            if (_fixtests)
            {
                lock (mutex)
                {
                    Console.WriteLine($"Fix test: {query}\nExpected:\n{expected.GetResult(cl)}\nGet:\n{res}\n00");
                    Console.WriteLine("Fix?(Y/N)");
                    expected.FixResult(res, cl);
                    if (expected.GetResult(cl) != res)
                    {
                        if (Console.ReadLine().Trim().ToLower() == "y")
                        {
                            expected.FixResult(res, cl);
                        }
                    }
                    expected.Save();
                }
            }
            Assert.AreEqual(expected.GetResult(cl), res);
            expected.Next(cl);
        }
Пример #3
0
 public void Next(TestApClient cl)
 {
     _last_res[cl.Name]++;
 }
Пример #4
0
 public void FixResult(string newres, TestApClient cl)
 {
     _expected[cl.Name][_last_res[cl.Name]] = newres.Replace("\"", "\\\"");
 }