private static void WriteTestResult(ITestNode testNode, IFixtureResult result) { ConsoleText.ColorCodes cColor = ConsoleText.ColorCodes.Red; string status = " FAIL! "; if (result.Right == (result.Right + result.Wrong + result.Exceptions)) { cColor = ConsoleText.ColorCodes.Green; status = " PASS! "; } else if ((result.Exceptions != 0) && (result.Wrong == 0)) { cColor = ConsoleText.ColorCodes.Yellow; status = " FAIL! "; } else { cColor = ConsoleText.ColorCodes.Red; status = " FAIL! "; } ConsoleText.SetColor(cColor); Console.Write(status); ConsoleText.SetColor(ConsoleText.DEFAULT_COLOR); if (testNode != null) { Console.Write(testNode.Name + "\t"); } Console.Write("Assertions:\t Pass:{0} \t Fail:{1} \t Exception:{2} \t {3}", result.Right, result.Wrong, result.Exceptions, result.GetTimeSpan().TotalSeconds + "sec"); }
public string GetResultHeader(IFixtureResult result) { string assertionText = string.Format("Assertions:\t Pass:{0} \t Fail:{1} \t Exception:{2} \t {3}", result.Right, result.Wrong, result.Exceptions, result.GetTimeSpan().TotalSeconds + "sec"); assertionText = assertionText.Replace("\t", " "); string status = "pass"; if ((result.Wrong + result.Exceptions) != 0) { status = "fail"; } return (string.Format( "<div style=\"border:1px solid silver;padding:5px \" class=\"{0}\"><strong>Assertions:</strong> {1}</div>", status, assertionText)); }