private static TestState checkNodeStatus(XmlNode node, out string desc)
{
desc = "";
if (node == null)
return TestState.Failed;
if (node.ChildNodes.Count == 1 && node.ChildNodes[0].NodeType == XmlNodeType.Text)
{
if (node.InnerText.ToLowerInvariant() == "failed")
{
if (node.Attributes != null && node.Attributes["FullName"] != null)
{
desc = string.Format(Resources.LrSLARuleFailed, node.Attributes["FullName"].Value,
node.Attributes["GoalValue"].Value, node.Attributes["ActualValue"].Value);
ConsoleWriter.WriteLine(desc);
}
return TestState.Failed;
}
else
{
return TestState.Passed;
}
}
//node has children
foreach (XmlNode childNode in node.ChildNodes)
{
TestState res = checkNodeStatus(childNode, out desc);
if (res == TestState.Failed)
{
if (string.IsNullOrEmpty(desc) && node.Attributes != null && node.Attributes["FullName"] != null)
{
desc = string.Format(Resources.LrSLARuleFailed, node.Attributes["FullName"].Value,
node.Attributes["GoalValue"].Value, node.Attributes["ActualValue"].Value);
ConsoleWriter.WriteLine(desc);
}
return TestState.Failed;
}
}
return TestState.Passed;
}