public void CheckSelect() { var tag = new Out(); tag.Select = new MockAttribute(new Constant("//note/to")); tag.Source = new MockAttribute(new Constant("xml")); Assert.That(tag.Evaluate(_model), Is.EqualTo("Tove, John")); }
public void CheckSelectNoneExistingVar() { var tag = new Out(); tag.Select = new MockAttribute(new Constant("//note[@id=\"1\"]/body")); tag.Source = new MockAttribute(new Constant("xmlnonexisting")); Assert.That(tag.Evaluate(_model), Is.EqualTo(String.Empty)); }
public void CheckSelectWrongXpathSyntax() { var tag = new Out(); tag.Select = new MockAttribute(new Constant("//note[@id=\"3\"/body")); tag.Source = new MockAttribute(new Constant("xml")); try { Assert.That(tag.Evaluate(_model), Is.EqualTo(String.Empty)); Assert.Fail("Expected exception"); } catch (TagException XPe) { Assert.That(XPe.Message.StartsWith(TagException.IllegalXPath(new Exception("")).Message), Is.True); } }
public void CheckSelectOneNodeNoEscapingSingleSlash() { var tag = new Out(); tag.Select = new MockAttribute(new Constant("//notes/note[@id=\"2\"]/body")); tag.Source = new MockAttribute(new Constant("xml")); tag.EscapeXml = new MockAttribute(new Constant("false")); Assert.That(tag.Evaluate(_model), Is.EqualTo("Read the previous memo & note")); }
public void CheckSelectOneNodeExplicitEscaping() { var tag = new Out(); tag.Select = new MockAttribute(new Constant("//note[@id=\"2\"]/body")); tag.Source = new MockAttribute(new Constant("xml")); tag.EscapeXml = new MockAttribute(new Constant("true")); Assert.That(tag.Evaluate(_model), Is.EqualTo("Read the previous memo & note")); }
public void CheckSelectNoXPath() { var tag = new Out(); tag.Source = new MockAttribute(new Constant("xmlnonexisting")); Assert.That(tag.Evaluate(_model), Is.EqualTo(String.Empty)); }