TestNode represents a single NUnit test result in the test model.
Inheritance: NUnit.Gui.Model.TestNode
Ejemplo n.º 1
0
        public TestResultEventArgs(TestAction action, ResultNode result) : base(action)
        {
            if (result == null)
                throw new ArgumentNullException("result");

            Result = result;
        }
Ejemplo n.º 2
0
 public void CreateResultNode_CurrentCultureWithDifferentDelimiter_DoesNotThrowException()
 {
     TestDelegate newResultNode = () =>
     {
         var resultNode = new ResultNode("<test-case duration='0.000'/>");
     };
     Assert.DoesNotThrow(newResultNode);
 }
Ejemplo n.º 3
0
        public TestEventArgs(TestAction action, ResultNode result)
        {
            if (result == null)
                throw new ArgumentNullException("result");

            this.Action = action;
            this.Result = result;
        }
Ejemplo n.º 4
0
        public TestResultEventArgs(TestAction action, ResultNode result) : base(action)
        {
            if (result == null)
            {
                throw new ArgumentNullException("result");
            }

            Result = result;
        }
Ejemplo n.º 5
0
        public void CreateResultNode_CurrentCultureWithDifferentDelimiter_DoesNotThrowException()
        {
            TestDelegate newResultNode = () =>
            {
                var resultNode = new ResultNode("<test-case duration='0.000'/>");
            };

            Assert.DoesNotThrow(newResultNode);
        }
Ejemplo n.º 6
0
        public void OnTestEvent(string report)
        {
            XmlNode xmlNode = XmlHelper.CreateXmlNode(report);

            switch (xmlNode.Name)
            {
            case "start-test":
                if (TestStarting != null)
                {
                    TestStarting(new TestNodeEventArgs(TestAction.TestStarting, new TestNode(xmlNode)));
                }
                break;

            case "start-suite":
                if (SuiteStarting != null)
                {
                    SuiteStarting(new TestNodeEventArgs(TestAction.SuiteStarting, new TestNode(xmlNode)));
                }
                break;

            case "start-run":
                if (RunStarting != null)
                {
                    RunStarting(new RunStartingEventArgs(xmlNode.GetAttribute("count", -1)));
                }
                break;

            case "test-case":
                ResultNode result = new ResultNode(xmlNode);
                _resultIndex[result.Id] = result;
                if (TestFinished != null)
                {
                    TestFinished(new TestResultEventArgs(TestAction.TestFinished, result));
                }
                break;

            case "test-suite":
                result = new ResultNode(xmlNode);
                _resultIndex[result.Id] = result;
                if (SuiteFinished != null)
                {
                    SuiteFinished(new TestResultEventArgs(TestAction.TestFinished, result));
                }
                break;

            case "test-run":
                result = new ResultNode(xmlNode);
                _resultIndex[result.Id] = result;
                if (RunFinished != null)
                {
                    RunFinished(new TestResultEventArgs(TestAction.RunFinished, result));
                }
                break;
            }
        }
Ejemplo n.º 7
0
        public static ResultSummary FromResultNode(ResultNode resultNode)
        {
            var result = resultNode.Xml;

            if (result.Name != "test-run")
            {
                throw new InvalidOperationException("Expected <test-run> as top-level element but was <" + result.Name + ">");
            }

            var summary = new ResultSummary();

            summary.OverallResult = resultNode.Outcome.Status.ToString();
            summary.Duration      = result.GetAttribute("duration", 0.0);
            summary.StartTime     = result.GetAttribute("start-time", DateTime.MinValue);
            summary.EndTime       = result.GetAttribute("end-time", DateTime.MaxValue);
            Summarize(result, summary);
            return(summary);
        }
Ejemplo n.º 8
0
 public TestEventArgs(TestAction action, ResultNode result)
 {
     // TODO: Add Guard for test
     this.Action = action;
     this.Result = result;
 }
Ejemplo n.º 9
0
 public TestEventArgs(TestAction action, ResultNode result)
 {
     // TODO: Add Guard for test
     this.Action = action;
     this.Result = result;
 }
Ejemplo n.º 10
0
        private ResultSummary CreateResultSummary(string xml)
        {
            var resultNode = new ResultNode(xml);

            return(ResultSummaryCreator.FromResultNode(resultNode));
        }