public TestVerdict ScratchMethod()
        {
            try
            {
                //using (var testMetric = new TestMetric("9999", "Test metric description"))
                //{
                //    testMetric.Start();
                //    Thread.Sleep(5000);
                //    testMetric.Stop();
                //};

                var testCheck = TestCheck.IsTrue("This is the first a sample test check", false, "I expected this to fail");
                testCheck = TestCheck.IsTrue("This is the second a sample test check", true, "I expected this to pass.");
                testCheck = TestCheck.IsTrue("This is the third a sample test check", false, $"Expected:  Pass, Actual:  Fail.");

                TestWarning.IsTrue(false, "This is a sample test warning.");

                TestTrace.Trace("This is a sample trace message");

                Thread.Sleep(5000);

                TestMessage += "Completed!";
                TestVerdict  = TestVerdict.Pass;
            }
            catch (Exception e)
            {
                TestMessage += e.ToString();
                TestVerdict  = TestVerdict.Error;
            }
            finally
            {
            }

            return(TestVerdict);
        }
        public override void OnTestWarning(TestWarning testWarning)
        {
            string padding = getPadding(testObjectDictionary[testStepKey] + 1);

            using (StreamWriter sw = File.AppendText(resultFile))
            {
                sw.WriteLine(padding + "TestWarning: " + testWarning.Comment);
                sw.WriteLine(padding + "  " + "Source: " + testWarning.Source);
            }
        }
 private void TestWarning_OnTestWarning(TestWarning testWarning)
 {
     if (this.InvokeRequired)
     {
         OnTestWarningDelegate d = new OnTestWarningDelegate(onTestWarning);
         BeginInvoke(d, new object[] { testWarning });
     }
     else
     {
         onTestWarning(testWarning);
     }
 }
 public override void OnTestWarning(TestWarning testWarning)
 {
     throw new NotImplementedException();
 }
 private void onTestWarning(TestWarning testWarning)
 {
     //m_testOutputViewer.AppendText(string.Format("Test warning:  {0}\n", testWarning.Comment));
     //m_testOutputViewer.ScrollToCaret();
 }
 public override void OnTestWarning(TestWarning testWarning)
 {
 }
Esempio n. 7
0
 public override void OnTestWarning(TestWarning testWarning)
 {
     Debug.WriteLine("SampleTestListener2 method:  " + MethodInfo.GetCurrentMethod().Name);
 }
Esempio n. 8
0
 private void TestWarning_OnTestWarning(TestWarning testWarning)
 {
     _listenerEventsClient?.OnTestWarning(testWarning);
 }
Esempio n. 9
0
        public void ProcessRequest(HttpContext context)
        {
            string logPath = context.Server.MapPath("Test.txt");

            if (!File.Exists(logPath))
            {
                File.Create(logPath);
            }
            try
            {
                var         urlRole           = context.Request.QueryString["role"];
                var         urlStructOrSensor = context.Request.QueryString["ss"];
                string      urlParams         = context.Request.QueryString["Url_params"];
                var         jsonParams        = JsonConvert.DeserializeObject <AlarmModel>(urlParams);
                string      url          = context.Request.QueryString["Url"];
                string      urlCount     = context.Request.QueryString["Url_count"];
                string      json_count   = HttpPost(urlCount, context, jsonParams);
                WaringCount warningCount = JsonConvert.DeserializeObject <WaringCount>(json_count);

                string iDisplayStart  = context.Request.QueryString["iDisplayStart"];
                string iDisplayLength = context.Request.QueryString["iDisplayLength"];
                int    sEcho          = Convert.ToInt32(context.Request.QueryString["sEcho"]);
                int    startRow       = Convert.ToInt32(iDisplayStart) + 1;
                int    endRow;
                if (Convert.ToInt32(iDisplayLength) == -1)
                {
                    endRow = startRow + warningCount.count - 1;
                }
                else
                {
                    endRow = startRow + Convert.ToInt32(iDisplayLength) - 1;
                }
                //获得分页的查询结果

                var listWanings = new List <Warning>();
                if (warningCount.count > 0)
                {
                    url += "&startRow=" + startRow + "&endRow=" + endRow;
                    string json = HttpPost(url, context, jsonParams);
                    if (urlStructOrSensor == "struct")
                    {
                        listWanings = HandleStructWarnings(json, urlRole);
                    }
                    else if (urlStructOrSensor == "sensor")
                    {
                        listWanings = HandleSensorWarnings(json, urlRole);
                    }
                }

                TestWarning testWarning = new TestWarning
                {
                    aaData               = listWanings,
                    iTotalRecords        = warningCount.count,
                    iTotalDisplayRecords = warningCount.count,
                    sEcho = sEcho
                };

                string jsonWarning = JsonConvert.SerializeObject(testWarning);
                context.Response.Write(jsonWarning);
            }
            catch (Exception e)
            {
                using (FileStream fs = new FileStream(logPath, FileMode.Open, FileAccess.Write))
                {
                    using (StreamWriter sw = new StreamWriter(fs))
                    {
                        sw.Write(e.Message);
                    }
                }
            }
        }
Esempio n. 10
0
 public abstract void OnTestWarning(TestWarning testWarning);
Esempio n. 11
0
		public override void Visit (TestWarning node)
		{
			;
		}
 private void onTestWarning(TestWarning testWarning)
 {
 }
Esempio n. 13
0
 public override void Visit(TestWarning node)
 {
     ;
 }