Esempio n. 1
0
        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));
            }
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
        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);
        }
Esempio n. 6
0
        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);
        }