ShowEmailWithinComments() public method

Checks if emails should be displayed with comments
public ShowEmailWithinComments ( ) : bool
return bool
Beispiel #1
0
        public void ShowEmailWithinComments_NullBlog()
        {
            var blogTemplateId = ID.NewID;

            var settings = Mock.Of<IWeBlogSettings>(x =>
                x.ContentRootPath == "/sitecore/content" &&
                x.BlogTemplateIds == new[] { ID.NewID, blogTemplateId, ID.NewID }
            );

            var manager = new BlogManager(settings);
            var result = manager.ShowEmailWithinComments(null);

            Assert.That(result, Is.False);
        }
Beispiel #2
0
        public void ShowEmailWithinComments(bool enabled)
        {
            var blogTemplateId = ID.NewID;

            var settings = Mock.Of<IWeBlogSettings>(x =>
                x.ContentRootPath == "/sitecore/content" &&
                x.BlogTemplateIds == new[] { ID.NewID, blogTemplateId, ID.NewID }
            );

            var manager = new BlogManager(settings);

            using (var db = new Db
            {
                new DbItem("blog", ID.NewID, blogTemplateId)
                {
                    { "Show Email Within Comments", enabled ? "1" : string.Empty }
                }
            })
            {
                var item = db.GetItem("/sitecore/content/blog");
                var result = manager.ShowEmailWithinComments(item);

                if (enabled)
                    Assert.That(result, Is.True);
                else
                {
                    Assert.That(result, Is.False);
                }
            }
        }