public static IRuleBuilderOptions <T, string> HasXmlTag <T>(this IRuleBuilder <T, string> ruleBuilder, IXmlProcessor xmlProcessor, string tagName) { return(ruleBuilder.Must((rootObject, value, context) => { context.MessageFormatter.AppendArgument("TagName", tagName); return xmlProcessor.IsTagPresent(tagName, value); }) .WithMessage("'{PropertyName}' is missing a '{TagName}' tag.")); }
public void IsTagPresent_WhenTagStartAndEndExistsInXml_ReturnTrue() { var result = _xmlProcessor.IsTagPresent("test", "this is a <test></test> xml"); Assert.IsTrue(result); }