public void AssertText(XmlNodeSimplified expectedNode) { if (expectedNode.NodeType != XmlNodeType.Text) { return; } var expectedText = expectedNode.InnerText; if (_assertContext.XmlNode.NodeType != XmlNodeType.Text) { var exceptionMsg = string.Format("Expected text, but found [{0}]", _assertContext.XmlNode.NodeType); _assertContext.ThrowErrorMessage(exceptionMsg); } var actualText = _assertContext.XmlNode.InnerText; var eq = _assertContext.StringComparer.Equals(actualText, expectedText); if (!eq) { var exceptionMsg = string.Format("Expected text [{0}], but found [{1}]", expectedText, actualText); _assertContext.ThrowErrorMessage(exceptionMsg); } }
public void AssertChildrenNumber(XmlNodeSimplified expected) { var childrenActual = _assertContext.XmlNode.Children.ToList(); var childrenExpected = expected.Children.ToList(); var equalChildrenNumber = childrenActual.Count == childrenExpected.Count; if (!equalChildrenNumber) { _assertContext.ThrowErrorMessage(string.Format("Number of children is " + "incorrent, expected [{0}], but was [{1}]", childrenExpected.Count, childrenActual.Count)); } }