private void AssertAllExpectedTagAttributesFoundInActualTag(Tag expectedTag, Tag actualTag, string displayMessage) { foreach (string key in expectedTag.Attributes.Keys) { if (key.Equals("/")) { continue; } string expectedValue = expectedTag[key]; string actualValue = actualTag[key]; if (key == Tag.TAGNAME) { expectedValue = ParserUtils.RemoveChars(expectedValue, '/'); actualValue = ParserUtils.RemoveChars(actualValue, '/'); AssertStringEquals(displayMessage + "]ntag name", expectedValue, actualValue); continue; } AssertStringEquals( "\nvalue for key " + key + " in tag " + expectedTag.TagName + " expected=" + expectedValue + " but was " + actualValue + "\n\nComplete Tag expected:\n" + expectedTag.ToHtml() + "\n\nComplete Tag actual:\n" + actualTag.ToHtml() + displayMessage, expectedValue, actualValue); } }
public static string RemoveEscapeCharacters(string inputString) { inputString = ParserUtils.RemoveChars(inputString, '\r'); inputString = inputString.Replace('\n', ' '); inputString = ParserUtils.RemoveChars(inputString, '\t'); return(inputString); }
private void AssertActualTagHasNoExtraAttributes(Tag expectedTag, Tag actualTag, string displayMessage) { foreach (string key in actualTag.Attributes.Keys) { if (key.Equals("/")) { continue; } string expectedValue = expectedTag[key]; string actualValue = actualTag[key]; if (key == Tag.TAGNAME) { expectedValue = ParserUtils.RemoveChars(expectedValue, '/'); actualValue = ParserUtils.RemoveChars(actualValue, '/'); AssertStringEquals(displayMessage + "]ntag name", actualValue, expectedValue); continue; } if (expectedValue == null) { Assert.Fail("\nActual tag had extra key: " + key + displayMessage); } } }