public void OnTestEvent(string report)
        {
            XmlNode xmlNode = XmlHelper.CreateXmlNode(report);

            switch (xmlNode.Name)
            {
            case "start-test":
                InvokeHandler(TestStarting, new TestNodeEventArgs(new TestNode(xmlNode)));
                break;

            case "start-suite":
                var testNode = new TestNode(xmlNode);

                CheckForProjectStart(testNode);

                InvokeHandler(SuiteStarting, new TestNodeEventArgs(testNode));
                break;

            case "start-run":
                InitializeProjectDictionary();
                InvokeHandler(RunStarting, new RunStartingEventArgs(xmlNode.GetAttribute("count", -1)));
                break;

            case "test-case":
                ResultNode resultNode = new ResultNode(xmlNode);
                _model.Results[resultNode.Id] = resultNode;
                InvokeHandler(TestFinished, new TestResultEventArgs(resultNode));
                break;

            case "test-suite":
                resultNode = new ResultNode(xmlNode);
                _model.Results[resultNode.Id] = resultNode;

                CheckForProjectFinish(resultNode);

                InvokeHandler(SuiteFinished, new TestResultEventArgs(resultNode));
                break;

            case "test-run":
                resultNode = new ResultNode(xmlNode);
                _model.Results[resultNode.Id] = resultNode;
                InvokeHandler(RunFinished, new TestResultEventArgs(resultNode));
                break;

            case "test-output":
                string testName = xmlNode.GetAttribute("testname");
                string stream   = xmlNode.GetAttribute("stream");
                string text     = xmlNode.InnerText;
                InvokeHandler(TestOutput, new TestOutputEventArgs(testName, stream, text));
                break;
            }
        }
        public void OnTestEvent(string report)
        {
            XmlNode xmlNode = XmlHelper.CreateXmlNode(report);

            switch (xmlNode.Name)
            {
            case "start-test":
                TestStarting?.Invoke(new TestNodeEventArgs(TestAction.TestStarting, new TestNode(xmlNode)));
                break;

            case "start-suite":
                SuiteStarting?.Invoke(new TestNodeEventArgs(TestAction.SuiteStarting, new TestNode(xmlNode)));
                break;

            case "start-run":
                RunStarting?.Invoke(new RunStartingEventArgs(xmlNode.GetAttribute("count", -1)));
                break;

            case "test-case":
                ResultNode result = new ResultNode(xmlNode);
                _model.Results[result.Id] = result;
                TestFinished?.Invoke(new TestResultEventArgs(TestAction.TestFinished, result));
                break;

            case "test-suite":
                result = new ResultNode(xmlNode);
                _model.Results[result.Id] = result;
                SuiteFinished?.Invoke(new TestResultEventArgs(TestAction.SuiteFinished, result));
                break;

            case "test-run":
                result = new ResultNode(xmlNode);
                _model.Results[result.Id] = result;
                RunFinished?.Invoke(new TestResultEventArgs(TestAction.RunFinished, result));
                break;
            }
        }
Ejemplo n.º 3
0
 private static XmlNode ToXml(this TestFilter filter)
 {
     return(XmlHelper.CreateXmlNode(filter.Text));
 }
Ejemplo n.º 4
0
 public TestNode(string xmlText) : this(XmlHelper.CreateXmlNode(xmlText))
 {
 }
 private TestNode MakeTestNode(string id, string name, string result)
 {
     return(new TestNode(XmlHelper.CreateXmlNode(string.Format("<test-case id='{0}' name='{1}' result='{2}'/>", id, name, result))));
 }