Ejemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RecentComments"/> class.
 /// </summary>
 public RecentComments()
 {
     int commentCount = Config.CurrentBlog.NumberOfRecentComments > 0
                            ? Config.CurrentBlog.NumberOfRecentComments
                            : DefaultRecentPostCount;
     ICollection<FeedbackItem> comments = Repository.GetRecentComments(commentCount);
     Comments = (from c in comments where c.EntryId > 0 select c).ToList();
     Gravatar = new GravatarService(ConfigurationManager.AppSettings);
 }
Ejemplo n.º 2
0
        public void GenerateUrlHashesEmailAddress()
        {
            //arrange
            var service = new GravatarService("{0}", true);

            //act
            string url = service.GenerateUrl("*****@*****.**");

            //assert
            Assert.Contains(url, "55502f40dc8b7c769880b10874abc9d0");
        }
Ejemplo n.º 3
0
        public void WhenCreatingGravatarServiceWithNullBoolean_NoExceptionIsThrown()
        {
            //arrange
            var settings = new NameValueCollection
            {
                {"GravatarEnabled", null},
                {"GravatarUrlFormatString", "{0}/{1}"}
            };

            //act
            var service = new GravatarService(settings);

            //assert
            Assert.IsFalse(service.Enabled);
            Assert.AreEqual("{0}/{1}", service.UrlFormatString);
        }
Ejemplo n.º 4
0
        public void CanCreateGravatarServiceWithNameValueCollection()
        {
            //arrange
            var settings = new NameValueCollection
            {
                {"GravatarEnabled", "true"},
                {"GravatarUrlFormatString", "{0}/{1}"}
            };

            //act
            var service = new GravatarService(settings);

            //assert
            Assert.IsTrue(service.Enabled);
            Assert.AreEqual("{0}/{1}", service.UrlFormatString);
        }
Ejemplo n.º 5
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            _gravatarService = new GravatarService(ConfigurationManager.AppSettings);

            if (Blog.CommentsEnabled)
            {
                BindFeedback(true);
            }
            else
            {
                Visible = false;
            }
        }