コード例 #1
0
ファイル: ConsoleRunner.cs プロジェクト: devfinity-fx/cpms_z
 void Instance_AfterPerformTestCase(object sender, TestCaseEventArgs e)
 {
     Console.WriteLine(string.Format("{0} ( {1,4} ms. {2,8} kb. )",
         (e.TestCaseInfo.Exception != null ? e.TestCaseInfo.ToString() : "passed"),
         e.TestCaseInfo.ElapsedMilliseconds, (e.TestCaseInfo.MemoryUsage/1024).ToString("###,###,##0")));
     if (e.TestCaseInfo.Exception != null)
     {
         Console.WriteLine("    " + e.TestCaseInfo.Exception.ToString());
     }
 }
コード例 #2
0
ファイル: RunForm.cs プロジェクト: devfinity-fx/cpms_z
        void Instance_BeforePerformTestCase(object sender, TestCaseEventArgs e)
        {
            bool showGrid = false;

            if(e.TestSetInfo.Instance is ReoGridTestSet)
            {
                ((ReoGridTestSet)e.TestSetInfo.Instance).Grid = grid;
                if (((ReoGridTestSet)e.TestSetInfo.Instance).ShowControl)
                {
                    showGrid = true;
                }
            }

            grid.Visible = showGrid;

            var listNode = GetItemByTestSetInfo(e.TestSetInfo);
            e.Cancel = listNode == null || !listNode.Checked;
        }
コード例 #3
0
ファイル: RunForm.cs プロジェクト: devfinity-fx/cpms_z
        void Instance_AfterPerformTestCase(object sender, TestCaseEventArgs e)
        {
            ListViewItem item = GetItemByTestSetInfo(e.TestSetInfo);

            item.SubItems[3].Text = string.Format("{0} ms.", e.TestCaseInfo.ElapsedMilliseconds);
            item.SubItems[4].Text = string.Format("{0} KB", (e.TestCaseInfo.MemoryUsage / 1024).ToString("###,###,##0"));

            Exception ex = e.TestCaseInfo.Exception;
            if (ex != null)
            {
                item.SubItems[2].Text = "Failed: " + ex.Message;
                item.ImageIndex = 2;

                exceptionBuffer.AppendLine(ex.ToString());
                exceptionBuffer.AppendLine();

                grid.Show();

                cellDebug.Show();
                cellDebug.Location = new Point(this.Right + 1, this.Top + 1);
                borderDebug.Show();
                borderDebug.Location = new Point(this.Right + 1, cellDebug.Bottom + 1);
            }
            else
            {
                item.SubItems[2].Text = "Success";
                item.ImageIndex = 1;
            }

            Application.DoEvents();
        }
コード例 #4
0
        internal bool RunTestCase(TestSetInfo testSetInfo, TestCaseInfo testCaseInfo)
        {
            object testSet = testSetInfo.Instance;

            stop.Reset();

            if (BeforePerformTestCase != null)
            {
                var evtArg = new TestCaseEventArgs(testSetInfo, testCaseInfo);
                BeforePerformTestCase(this, evtArg);
                if (evtArg.Cancel) return true;
            }

            GC.Collect(0, GCCollectionMode.Forced);
            long mem = GetProcessMemoryUsage();

            stop.Start();

            try
            {
                testCaseInfo.Method.Invoke(testSet, null);
            }
            catch (TargetInvocationException x)
            {
                testCaseInfo.Exception = x.InnerException;
            }
            catch (TestCaseFailureException x)
            {
                testCaseInfo.Exception = x;
            }

            stop.Stop();

            testCaseInfo.Performed = true;
            testCaseInfo.ElapsedMilliseconds = stop.ElapsedMilliseconds;
            testCaseInfo.MemoryUsage = GetProcessMemoryUsage() - mem;

            GC.Collect(0, GCCollectionMode.Forced);

            if (AfterPerformTestCase != null)
            {
                AfterPerformTestCase(this, new TestCaseEventArgs(testSetInfo, testCaseInfo));
            }

            return testCaseInfo.Exception != null;
        }
コード例 #5
0
ファイル: ConsoleRunner.cs プロジェクト: devfinity-fx/cpms_z
 void Instance_BeforePerformTestCase(object sender, TestCaseEventArgs e)
 {
     Console.Write(string.Format("    {0,-38}... ", e.TestCaseInfo.Name));
 }