Exemple #1
0
        // Метод тестирует все классы
        private static void TestAll()
        {
            String error_message = "";

#if DEBUG
            //error_message+=Utilits.CheckTestResult( Converter.Test() ); НЕТ ТЕСТА
            error_message += Utilits.CheckTestResult(Decorator.Test());
            error_message += Utilits.CheckTestResult(FormView.Test());
            //error_message+=Utilits.CheckTestResult( Methods.Test() ); ТЕСТ КРИВОЙ
#else
#endif
            if (error_message != "")
            {
                Utilits.ShowMessage(error_message);
            }
        }
Exemple #2
0
        // Запускает вьюшку
        private void RunView()
        {
            FormView f = new FormView(list_results);

            f.Show();
        }
Exemple #3
0
        /// <summary>
        /// Тест вьюшки DEBUG
        /// </summary>
        /// <returns>Всё ли верно</returns>
        public static Dictionary <string, bool> Test()
        {
            Dictionary <string, bool> testCases = new Dictionary <string, bool>();

            List <List <MethodInfo> > lol;
            FormView f;
            Label    lblexc;
            Chart    crtGraph;

            //  FormView
            f = new FormView();
            if (f.MinimumSize == new Size(400, 300) && f.ShowIcon == false)
            {
                testCases.Add("FormView", true);
            }
            else
            {
                testCases.Add("FormView", false);
            }

            // FormView(List) – конструктор. 3 теста.
            // Типичная рабочая ситуация.
            lol      = CreateSomeGraphData(10, 10);
            f        = new FormView(lol);
            crtGraph = (Chart)f.Controls["crtGraph"];
            if (crtGraph.Legends.Count == 1 && crtGraph.ChartAreas.Count == 1)
            {
                testCases.Add("FormView(List) : Валидные данные", true);
            }
            else
            {
                testCases.Add("FormView(List) : Валидные данные", false);
            }

            // Список без данных
            lol    = CreateSomeGraphData(0, 10);
            f      = new FormView(lol);
            lblexc = (Label)f.Controls["lblexc"];
            if (lblexc.Text == "Нет данных о методах. Нечего рисовать.")
            {
                testCases.Add("FormView(List) : 0 методов", true);
            }
            else
            {
                testCases.Add("FormView(List) : 0 методов", false);
            }

            // Список с неверными данными
            lol    = CreateSomeGraphData(10, 0);
            f      = new FormView(lol);
            lblexc = (Label)f.Controls["lblexc"];
            if (lblexc.Text == "Данные были, но неверные. Всё удалено. Нечего рисовать.")
            {
                testCases.Add("FormView(List) : 0 прогонов", true);
            }
            else
            {
                testCases.Add("FormView(List) : 0 прогонов", false);
            }

            //  InitializeForm
            f             = new FormView();
            f.MinimumSize = new Size(400, 300);
            f.ShowIcon    = false;
            f.InitializeForm();
            if (f.MinimumSize == new Size(400, 300) && f.ShowIcon == false)
            {
                testCases.Add("InitializeForm", true);
            }
            else
            {
                testCases.Add("InitializeForm", false);
            }

            // CheckInfo
            if (testCases["FormView(List) : Валидные данные"] && testCases["FormView(List) : 0 методов"] && testCases["FormView(List) : 0 прогонов"])
            {
                testCases.Add("CheckInfo", true);
            }
            else
            {
                testCases.Add("CheckInfo", false);
            }

            // DrawGraph
            f.DrawGraph(f.CheckInfo(CreateSomeGraphData(10, 10)));
            crtGraph = (Chart)f.Controls["crtGraph"];
            if (crtGraph.Series.First().Points.First().XValue == 0)
            {
                testCases.Add("DrawGraph", true);
            }
            else
            {
                testCases.Add("DrawGraph", false);
            }

            return(testCases);

            /* Запуск теста. Скопировать в основную форму для автоматического тестирования вьюшки.
             *  Dictionary<string, bool> viewTestCases = FormView.Test();
             *  string viewTestResult = "";
             *
             *  foreach (var test in viewTestCases)
             *      viewTestResult += test.Key + "\t" + test.Value.ToString() + "\n";
             *
             *  MessageBox.Show(viewTestResult);
             */
        }