public void Test(string input, string expected, string xpath) { var procesor = new FirstContentBlock { FieldName = "Text", XPath = xpath }; using (var db = new Db { new DbItem("item") { new DbField("text") { Value = input } } }) { var args = new GetSummaryArgs { Entry = db.GetItem("/sitecore/content/item") }; procesor.Process(args); Assert.That(args.Summary, Is.EqualTo(expected)); } }
public void ContainsCutTag() { var procesor = new FirstContentBlock(); procesor.XPath = "//hr"; var args = new GetSummaryArgs(); args.Entry = m_contentSurroundingTag; procesor.Process(args); Assert.AreEqual("<div>Lorem ipsum</div>", args.Summary); }
public void ContainsNoTag() { var procesor = new FirstContentBlock(); procesor.XPath = "//hr"; var args = new GetSummaryArgs(); args.Entry = m_contentNoTags; procesor.Process(args); Assert.IsNullOrEmpty(args.Summary); }
public void ContainsSurroundingTag() { var procesor = new FirstContentBlock(); procesor.XPath = "//span"; var args = new GetSummaryArgs(); args.Entry = m_contentContainsSpan; procesor.Process(args); Assert.AreEqual("Nullam et arcu dui, in pharetra diam. In vitae ante ac orci mollis egestas a ", args.Summary); }
public void ContainsSelfClosingTag() { var procesor = new FirstContentBlock(); procesor.XPath = "//hr"; var args = new GetSummaryArgs(); args.Entry = m_contentContainsHr; procesor.Process(args); Assert.AreEqual("Lorem ipsum", args.Summary); }
public void NullItem() { var procesor = new FirstContentBlock { FieldName = "Text", XPath = "//hr" }; var args = new GetSummaryArgs { Entry = null }; procesor.Process(args); Assert.That(args.Summary, Is.Empty); }