private static ITestAssertion CreateFailedAssertNoThrow(TestCaseResult parent, XmlAttributeCollection node) { string[] values = GetAttributeValues(node, new string[] { "line", "expression" }); int line = GetLineNumber(node); return(new Assertion(parent, line, TestResultStatus.Failed, MsgFailedAssertNoThrow, values)); }
private static ITestAssertion CreateFailedAssertPredicate(TestCaseResult parent, XmlAttributeCollection node) { string[] values = GetAttributeValues(node, new string[] { "line", "arg-desc", "arg-desc", "predicate" }); int line = GetLineNumber(node); return(new Assertion(parent, line, TestResultStatus.Failed, MsgFailedAssertPredicate, values)); }
private static ITestAssertion CreateFailedAssertSameData(TestCaseResult parent, XmlAttributeCollection node) { string[] values = GetAttributeValues(node, new string[] { "line", "lhs-desc", "rhs-desc", "lhs-value", "rhs-value", "size-desc", "size-value" }); int line = GetLineNumber(node); return(new Assertion(parent, line, TestResultStatus.Failed, MsgFailedAssertSameData, values)); }
public AssertionWithStackTrace(TestCaseResult parent, int lineNumber, TestResultStatus status) { this.parent = parent; this.status = status; this.lineNumber = lineNumber; parent.AddAssertion(this); backtrace = new List <BacktraceFrame>(); }
public Assertion(TestCaseResult parent, int lineNumber, TestResultStatus status, string message, string[] args) { this.parent = parent; this.status = status; this.message = message; this.args = args; this.lineNumber = lineNumber; parent.AddAssertion(this); }
public AssertionWithStackTrace(TestCaseResult parent, int lineNumber, TestResultStatus status) { this.parent = parent; this.status = status; this.lineNumber = lineNumber; parent.AddAssertion(this); backtrace = new List<BacktraceFrame>(); }
public static ITestAssertion Create(TestCaseResult parent, string type, XmlAttributeCollection attributes) { switch (type) { case "trace": return CreateTrace(parent, attributes); case "warning": return CreateWarning(parent, attributes); case "failed-test": return CreateFailedTest(parent, attributes); case "failed-assert": return CreateFailedAssert(parent, attributes); case "failed-assert-eq": return CreateFailedAssertEq(parent, attributes); case "failed-assert-same-data": return CreateFailedAssertSameData(parent, attributes); case "failed-assert-delta": return CreateFailedAssertDelta(parent, attributes); case "failed-assert-ne": return CreateFailedAssertNe(parent, attributes); case "failed-assert-lt": return CreateFailedAssertLt(parent, attributes); case "failed-assert-le": return CreateFailedAssertLe(parent, attributes); case "failed-assert-relation": return CreateFailedAssertRelation(parent, attributes); case "failed-assert-predicate": return CreateFailedAssertPredicate(parent, attributes); case "failed-assert-throws": return CreateFailedAssertThrows(parent, attributes); case "failed-assert-nothrow": return CreateFailedAssertNoThrow(parent, attributes); default: return null; } }
static public ITestAssertion Create(TestCaseResult parent, string type, XmlAttributeCollection attributes) { switch (type) { case "trace": return(CreateTrace(parent, attributes)); case "warning": return(CreateWarning(parent, attributes)); case "failed-test": return(CreateFailedTest(parent, attributes)); case "failed-assert": return(CreateFailedAssert(parent, attributes)); case "failed-assert-eq": return(CreateFailedAssertEq(parent, attributes)); case "failed-assert-same-data": return(CreateFailedAssertSameData(parent, attributes)); case "failed-assert-delta": return(CreateFailedAssertDelta(parent, attributes)); case "failed-assert-ne": return(CreateFailedAssertNe(parent, attributes)); case "failed-assert-lt": return(CreateFailedAssertLt(parent, attributes)); case "failed-assert-le": return(CreateFailedAssertLe(parent, attributes)); case "failed-assert-relation": return(CreateFailedAssertRelation(parent, attributes)); case "failed-assert-predicate": return(CreateFailedAssertPredicate(parent, attributes)); case "failed-assert-throws": return(CreateFailedAssertThrows(parent, attributes)); case "failed-assert-nothrow": return(CreateFailedAssertNoThrow(parent, attributes)); default: return(null); } }
private static ITestAssertion CreateFailedAssertThrows(TestCaseResult parent, XmlAttributeCollection node) { string[] values = GetAttributeValues(node, new string[] { "line", "expression", "type", "threw" }); int line = GetLineNumber(node); if (values[3] == "other") { values[3] = "it threw a different type"; } else { values[3] = "it threw nothing"; } return(new Assertion(parent, line, TestResultStatus.Failed, MsgFailedAssertThrows, values)); }
private static ITestAssertion CreateWarning(TestCaseResult parent, XmlAttributeCollection node) { int line = GetLineNumber(node); return new AssertionWithStackTrace(parent, line, TestResultStatus.Warning); }
private static ITestAssertion CreateTrace(TestCaseResult parent, XmlAttributeCollection node) { string[] values = GetAttributeValues(node, new string[] { "line", "message" }); int line = GetLineNumber(node); return new Assertion(parent, line, TestResultStatus.OK, MsgTrace, values); }
private static ITestAssertion CreateFailedAssertThrows(TestCaseResult parent, XmlAttributeCollection node) { string[] values = GetAttributeValues(node, new string[] { "line", "expression", "type", "threw" }); int line = GetLineNumber(node); if(values[3] == "other") values[3] = "it threw a different type"; else values[3] = "it threw nothing"; return new Assertion(parent, line, TestResultStatus.Failed, MsgFailedAssertThrows, values); }
private static ITestAssertion CreateFailedAssertSameData(TestCaseResult parent, XmlAttributeCollection node) { string[] values = GetAttributeValues(node, new string[] { "line", "lhs-desc", "rhs-desc", "lhs-value", "rhs-value", "size-desc", "size-value" }); int line = GetLineNumber(node); return new Assertion(parent, line, TestResultStatus.Failed, MsgFailedAssertSameData, values); }
private static ITestAssertion CreateFailedAssertPredicate(TestCaseResult parent, XmlAttributeCollection node) { string[] values = GetAttributeValues(node, new string[] { "line", "arg-desc", "arg-desc", "predicate" }); int line = GetLineNumber(node); return new Assertion(parent, line, TestResultStatus.Failed, MsgFailedAssertPredicate, values); }
private static ITestAssertion CreateFailedAssertNoThrow(TestCaseResult parent, XmlAttributeCollection node) { string[] values = GetAttributeValues(node, new string[] { "line", "expression" }); int line = GetLineNumber(node); return new Assertion(parent, line, TestResultStatus.Failed, MsgFailedAssertNoThrow, values); }
private static ITestAssertion CreateFailedTest(TestCaseResult parent, XmlAttributeCollection node) { int line = GetLineNumber(node); return(new AssertionWithStackTrace(parent, line, TestResultStatus.Error)); }
private void ProcessTest(TestSuiteResult suite, XmlNode testNode) { TestCaseResult testCase = new TestCaseResult(suite, testNode.Attributes); foreach (XmlNode child in testNode.ChildNodes) { ITestAssertion assertion = TestAssertionFactory.Create( testCase, child.Name, child.Attributes); if(assertion is AssertionWithStackTrace) { AssertionWithStackTrace ast = (AssertionWithStackTrace)assertion; ast.SetMessage(child.InnerText); foreach (XmlNode child2 in child.ChildNodes) { if (child2.Name == "stack-frame") { BacktraceFrame frame = ProcessStackFrame(child2); ast.AddBacktraceFrame(frame); } } } } }