コード例 #1
0
ファイル: MetaTagInsertTests.cs プロジェクト: ayende/Subtext
        public void CanInsertNewMetaTag(string content, string name, string httpEquiv, bool withEntry, string errMsg)
        {
            this.blog = UnitTestHelper.CreateBlogAndSetupContext();

            int? entryId = null;
            if (withEntry)
            {
                Entry e = UnitTestHelper.CreateEntryInstanceForSyndication("Steven Harman", "My Post", "Foo Bar Zaa!");
                entryId = Entries.Create(e);
            }

            MetaTag mt = UnitTestHelper.BuildMetaTag(content, name, httpEquiv, blog.Id, entryId, DateTime.Now);

            // make sure there are no meta-tags for this blog in the data store
            IList<MetaTag> tags = MetaTags.GetMetaTagsForBlog(blog, 0, 100);
            Assert.AreEqual(0, tags.Count, "Should be zero MetaTags.");

            // add the meta-tag to the data store
            int tagId = MetaTags.Create(mt);

            tags = MetaTags.GetMetaTagsForBlog(blog, 0, 100);

            Assert.AreEqual(1, tags.Count, errMsg);

            MetaTag newTag = tags[0];

            // make sure all attributes of the meta-tag were written to the data store correctly.
            Assert.AreEqual(tagId, newTag.Id, "Wrong Id");
            Assert.AreEqual(mt.Content, newTag.Content, "Wrong content");
            Assert.AreEqual(mt.Name, newTag.Name, "wrong name attribute");
            Assert.AreEqual(mt.HttpEquiv, newTag.HttpEquiv, "Wrong http-equiv attriubte");
            Assert.AreEqual(mt.BlogId, newTag.BlogId, "Wrong blogId");
            Assert.AreEqual(mt.EntryId, newTag.EntryId, "Wrong entryId");
            Assert.AreEqual(mt.DateCreated.Date, newTag.DateCreated.Date, "Wrong created date");
        }
コード例 #2
0
        public void CanUpdateEnclosure(string title, string url, string mimetype, long size, bool addToFeed, bool showWithPost)
        {
            this.blog = UnitTestHelper.CreateBlogAndSetupContext();
            Entry e = UnitTestHelper.CreateEntryInstanceForSyndication("Simone Chiaretta", "Post for testing Enclosures", "Listen to my great podcast");
            int entryId = Entries.Create(e);
            Enclosure enc = UnitTestHelper.BuildEnclosure(title, url, mimetype, entryId, size, addToFeed, showWithPost);

            Enclosures.Create(enc);

            string randomStr = StringHelper.Left(UnitTestHelper.GenerateRandomString(), 20);
            enc.Url = url + randomStr;

            if (!string.IsNullOrEmpty(title))
                enc.Title = title + randomStr;

            enc.MimeType = mimetype + randomStr;

            int randomSize = new Random().Next(10, 100);
            enc.Size = size + randomSize;

            Assert.IsTrue(Enclosures.Update(enc),"Should have updated the Enclosure");

            Entry newEntry = Entries.GetEntry(entryId, false);

            UnitTestHelper.AssertEnclosures(enc, newEntry.Enclosure);
        }
コード例 #3
0
ファイル: BlogInfoTests.cs プロジェクト: ayende/Subtext
        public void CanGetHashCode()
        {
            BlogInfo blog = new BlogInfo();
            blog.Host = "http://subtextproject.com";
            blog.Subfolder = "blog";

            Assert.AreEqual(-1988688221, blog.GetHashCode());
        }
コード例 #4
0
ファイル: BlogInfoTests.cs プロジェクト: ayende/Subtext
        public void CanSetFeedBurnerName()
        {
            BlogInfo blog = new BlogInfo();
            blog.FeedBurnerName = null;
            Assert.IsFalse(blog.FeedBurnerEnabled);

            blog.FeedBurnerName = "Subtext";
            Assert.IsTrue(blog.FeedBurnerEnabled);
        }
コード例 #5
0
ファイル: MetaTagUpdateTests.cs プロジェクト: ayende/Subtext
        public void CantUpateWithNullMetaTag()
        {
            this.blog = UnitTestHelper.CreateBlogAndSetupContext();

            MetaTag tag = UnitTestHelper.BuildMetaTag("Yet again...", null, "description", blog.Id, null, DateTime.Now);
            MetaTags.Create(tag);

            MetaTags.Update(null);
        }
コード例 #6
0
        public void EntryWithNoEnclusureHasNullAsEnclosure()
        {
            this.blog = UnitTestHelper.CreateBlogAndSetupContext();
            Entry e = UnitTestHelper.CreateEntryInstanceForSyndication("Simone Chiaretta", "Post for testing Enclosures", "Listen to my great podcast");
            int entryId = Entries.Create(e);

            Entry newEntry = Entries.GetEntry(entryId, false);

            Assert.IsNull(newEntry.Enclosure, "Enclusure must be null");
        }
コード例 #7
0
ファイル: MetaTagGetTests.cs プロジェクト: ayende/Subtext
        public void CanGetMetaTagsForBlog()
        {
            this.blog = UnitTestHelper.CreateBlogAndSetupContext();

            InsertNewMetaTag("Adding description meta tag", "description", null, DateTime.Now, blog.Id, null);
            InsertNewMetaTag("no-cache", null, "cache-control", DateTime.Now, blog.Id, null);

            IList<MetaTag> tags = MetaTags.GetMetaTagsForBlog(blog, 0, 100);

            Assert.AreEqual(2, tags.Count, "Should be two tags for this blog.");
        }
コード例 #8
0
ファイル: BlogInfoTests.cs プロジェクト: ayende/Subtext
        public void CanGetLanguageAndLanguageCode()
        {
            BlogInfo blog = new BlogInfo();
            blog.Language = null;
            Assert.AreEqual("en-US", blog.Language, "By default, the language is en-US");
            Assert.AreEqual("en", blog.LanguageCode);

            blog.Language = "fr-FR";
            Assert.AreEqual("fr-FR", blog.Language, "The language should have changed.");
            Assert.AreEqual("fr", blog.LanguageCode);
        }
コード例 #9
0
        public void CommentRssWriterProducesValidEmptyFeed()
        {
            UnitTestHelper.SetHttpContextWithBlogRequest("localhost", "blog");

            BlogInfo blogInfo = new BlogInfo();
            blogInfo.Host = "localhost";
            blogInfo.Subfolder = "blog";
            blogInfo.Email = "*****@*****.**";
            blogInfo.RFC3229DeltaEncodingEnabled = true;
            blogInfo.Title = "My Blog Rulz";
            blogInfo.TimeZoneId = PacificTimeZoneId;

            HttpContext.Current.Items.Add("BlogInfo-", blogInfo);

            Entry entry = new Entry(PostType.None);
            entry.AllowComments = true;
            entry.Title = "Comments requiring your approval.";
            entry.Url = "/Admin/Feedback.aspx?status=2";
            entry.Body = "The following items are waiting approval.";
            entry.PostType = PostType.None;
            ModeratedCommentRssWriter writer = new ModeratedCommentRssWriter(new List<FeedbackItem>(), entry);

            string expected = @"<rss version=""2.0"" "
                                    + @"xmlns:dc=""http://purl.org/dc/elements/1.1/"" "
                                    + @"xmlns:trackback=""http://madskills.com/public/xml/rss/module/trackback/"" "
                                    + @"xmlns:wfw=""http://wellformedweb.org/CommentAPI/"" "
                                    + @"xmlns:slash=""http://purl.org/rss/1.0/modules/slash/"" "
                                    + @"xmlns:copyright=""http://blogs.law.harvard.edu/tech/rss"" "
                                    + @"xmlns:image=""http://purl.org/rss/1.0/modules/image/"">" + Environment.NewLine
                                + indent() + @"<channel>" + Environment.NewLine
                                        + indent(2) + @"<title>Comments requiring your approval.</title>" + Environment.NewLine
                                        + indent(2) + @"<link>http://localhost/blog/Admin/Feedback.aspx?status=2</link>" + Environment.NewLine
                                        + indent(2) + @"<description>The following items are waiting approval.</description>" + Environment.NewLine
                                        + indent(2) + @"<language>en-US</language>" + Environment.NewLine
                                        + indent(2) + @"<copyright>Subtext Weblog</copyright>" + Environment.NewLine
                                        + indent(2) + @"<generator>{0}</generator>" + Environment.NewLine
                                        + indent(2) + @"<image>" + Environment.NewLine
                                            + indent(3) + @"<title>Comments requiring your approval.</title>" + Environment.NewLine
                                            + indent(3) + @"<url>http://localhost/images/RSS2Image.gif</url>" + Environment.NewLine
                                            + indent(3) + @"<link>http://localhost/blog/Admin/Feedback.aspx?status=2</link>" + Environment.NewLine
                                            + indent(3) + @"<width>77</width>" + Environment.NewLine
                                            + indent(3) + @"<height>60</height>" + Environment.NewLine
                                        + indent(2) + @"</image>" + Environment.NewLine
                                + indent(1) + @"</channel>" + Environment.NewLine
                              + @"</rss>";

            expected = string.Format(expected, VersionInfo.VersionDisplayText);

            Console.WriteLine("EXPECTED: " + expected);
            Console.WriteLine("ACTUAL  : " + writer.Xml);
            Assert.AreEqual(expected, writer.Xml);
        }
コード例 #10
0
        public void CommentRssWriterProducesValidEmptyFeed()
        {
            UnitTestHelper.SetHttpContextWithBlogRequest("localhost", "blog");

            BlogInfo blogInfo = new BlogInfo();
            blogInfo.Host = "localhost";
            blogInfo.Subfolder = "blog";
            blogInfo.Email = "*****@*****.**";
            blogInfo.RFC3229DeltaEncodingEnabled = true;
            blogInfo.Title = "My Blog Rulz";
            blogInfo.TimeZoneId = PacificTimeZoneId;

            HttpContext.Current.Items.Add("BlogInfo-", blogInfo);

            Entry entry = UnitTestHelper.CreateEntryInstanceForSyndication("haacked", "title of the post", "Body of the post.");
            entry.EntryName = "titleofthepost";
            entry.DateCreated = entry.DateSyndicated = entry.DateModified = DateTime.ParseExact("2006/04/01", "yyyy/MM/dd", CultureInfo.InvariantCulture);
            entry.Url = "/archive/2006/04/01/titleofthepost.aspx";
            CommentRssWriter writer = new CommentRssWriter(new List<FeedbackItem>(), entry);

            Assert.IsTrue(entry.HasEntryName, "This entry should have an entry name.");

            string expected = @"<rss version=""2.0"" "
                                    + @"xmlns:dc=""http://purl.org/dc/elements/1.1/"" "
                                    + @"xmlns:trackback=""http://madskills.com/public/xml/rss/module/trackback/"" "
                                    + @"xmlns:wfw=""http://wellformedweb.org/CommentAPI/"" "
                                    + @"xmlns:slash=""http://purl.org/rss/1.0/modules/slash/"" "
                                    + @"xmlns:copyright=""http://blogs.law.harvard.edu/tech/rss"" "
                                    + @"xmlns:image=""http://purl.org/rss/1.0/modules/image/"">" + Environment.NewLine
                                + indent() + @"<channel>" + Environment.NewLine
                                        + indent(2) + @"<title>title of the post</title>" + Environment.NewLine
                                        + indent(2) + @"<link>http://localhost/blog/archive/2006/04/01/titleofthepost.aspx</link>" + Environment.NewLine
                                        + indent(2) + @"<description>Body of the post.</description>" + Environment.NewLine
                                        + indent(2) + @"<language>en-US</language>" + Environment.NewLine
                                        + indent(2) + @"<copyright>Subtext Weblog</copyright>" + Environment.NewLine
                                        + indent(2) + @"<generator>{0}</generator>" + Environment.NewLine
                                        + indent(2) + @"<image>" + Environment.NewLine
                                            + indent(3) + @"<title>title of the post</title>" + Environment.NewLine
                                            + indent(3) + @"<url>http://localhost/images/RSS2Image.gif</url>" + Environment.NewLine
                                            + indent(3) + @"<link>http://localhost/blog/archive/2006/04/01/titleofthepost.aspx</link>" + Environment.NewLine
                                            + indent(3) + @"<width>77</width>" + Environment.NewLine
                                            + indent(3) + @"<height>60</height>" + Environment.NewLine
                                        + indent(2) + @"</image>" + Environment.NewLine
                                + indent(1) + @"</channel>" + Environment.NewLine
                              + @"</rss>";

            expected = string.Format(expected, VersionInfo.VersionDisplayText);

            Console.WriteLine("EXPECTED: " + expected);
            Console.WriteLine("ACTUAL  : " + writer.Xml);
            Assert.AreEqual(expected, writer.Xml);
        }
コード例 #11
0
        public void CanInsertEnclosure(string title, string url, string mimetype, long size, bool addToFeed, bool showWithPost, string errMsg)
        {
            this.blog = UnitTestHelper.CreateBlogAndSetupContext();
            Entry e = UnitTestHelper.CreateEntryInstanceForSyndication("Simone Chiaretta", "Post for testing Enclosures", "Listen to my great podcast");
            int entryId = Entries.Create(e);
            Enclosure enc = UnitTestHelper.BuildEnclosure(title, url, mimetype, entryId, size, addToFeed, showWithPost);

            Enclosures.Create(enc);

            Entry newEntry = Entries.GetEntry(entryId, false);

            Assert.IsNotNull(newEntry.Enclosure,errMsg);

            UnitTestHelper.AssertEnclosures(enc,newEntry.Enclosure);
        }
コード例 #12
0
ファイル: MetaTagDeleteTests.cs プロジェクト: ayende/Subtext
        public void CanDeleteBlogMetaTag()
        {
            blog = UnitTestHelper.CreateBlogAndSetupContext();

            MetaTag tag =
                UnitTestHelper.BuildMetaTag("Steve Harman likes to delete stuff!", "description", null, blog.Id, null,
                                            DateTime.Now);
            MetaTags.Create(tag);
            Assert.AreEqual(1, MetaTags.GetMetaTagsForBlog(blog, 0, 100).Count, "Should be one (1) MetaTag for this blog.");

            // Now let's remove it from the data store
            Assert.IsTrue(MetaTags.Delete(tag.Id), "Deleting the MetaTag failed.");

            Assert.AreEqual(0, MetaTags.GetMetaTagsForBlog(blog, 0, 100).Count, "Should be zero (0) MetaTags for this blog.");
        }
コード例 #13
0
ファイル: MetaTagUpdateTests.cs プロジェクト: ayende/Subtext
        public void CanRemoveHttpEquivAndAddName()
        {
            this.blog = UnitTestHelper.CreateBlogAndSetupContext();

            MetaTag tag = UnitTestHelper.BuildMetaTag("Still nothing to see here.", null, "expires", blog.Id, null, DateTime.Now);
            MetaTags.Create(tag);

            tag.HttpEquiv = null;
            tag.Name = "author";
            tag.Content = "Steve-o-rino!";

            MetaTags.Update(tag);

            ValidateMetaTags(tag, MetaTags.GetMetaTagsForBlog(blog, 0, 100)[0]);
        }
コード例 #14
0
ファイル: MetaTagUpdateTests.cs プロジェクト: ayende/Subtext
        public void CanRemoveNameAndAddHttpEquiv()
        {
            this.blog = UnitTestHelper.CreateBlogAndSetupContext();

            MetaTag tag = UnitTestHelper.BuildMetaTag("Nothing to see here.", "description", null, blog.Id, null, DateTime.Now);
            MetaTags.Create(tag);

            tag.HttpEquiv = "cache-control";
            tag.Name = null;
            tag.Content = "no-cache";

            MetaTags.Update(tag);

            ValidateMetaTags(tag, MetaTags.GetMetaTagsForBlog(blog, 0, 100)[0]);
        }
コード例 #15
0
ファイル: RssWriterTests.cs プロジェクト: ayende/Subtext
        public void RssImageUrlConcatenatedProperly(string application, string subfolder, string expected)
        {
            UnitTestHelper.SetHttpContextWithBlogRequest("localhost", subfolder, application);
            BlogInfo blogInfo = new BlogInfo();
            blogInfo.Host = "localhost";
            blogInfo.Subfolder = subfolder;
            blogInfo.Title = "My Blog Is Better Than Yours";
            blogInfo.Email = "*****@*****.**";
            blogInfo.RFC3229DeltaEncodingEnabled = true;

            HttpContext.Current.Items.Add("BlogInfo-", blogInfo);

            RssWriter writer = new RssWriter(new List<Entry>(), DateTime.Now, false);
            Uri rssImageUrl = writer.GetRssImage();
            Assert.AreEqual(expected, rssImageUrl.ToString(), "not the expected url.");
        }
コード例 #16
0
        public void CantUpdateWithInvalidEnclosure(string url, string mimetype, long size, string errMsg)
        {
            this.blog = UnitTestHelper.CreateBlogAndSetupContext();

            Entry e = UnitTestHelper.CreateEntryInstanceForSyndication("Simone Chiaretta", "Post for testing Enclosures", "Listen to my great podcast");
            int entryId = Entries.Create(e);

            Enclosure enc = UnitTestHelper.BuildEnclosure("Nothing to see here.", "httP://blablabla.com", "audio/mp3", entryId, 12345678, true, true);
            Enclosures.Create(enc);

            enc.Url = url;
            enc.MimeType = mimetype;
            enc.Size = size;

            Enclosures.Update(enc);
        }
コード例 #17
0
ファイル: MetaTagGetTests.cs プロジェクト: ayende/Subtext
        public void CanGetMetaTagsForEntry()
        {
            this.blog = UnitTestHelper.CreateBlogAndSetupContext();

            Entry e = UnitTestHelper.CreateEntryInstanceForSyndication("Steve-o", "Bar", "Steve is still rockin it... or is he?");
            Entries.Create(e);

            InsertNewMetaTag("Adding description meta tag", "description", null, DateTime.Now, blog.Id, null);
            InsertNewMetaTag("no-cache", null, "cache-control", DateTime.Now, blog.Id, null);

            // insert a few entry specific tags
            InsertNewMetaTag("Yet Another MetaTag", "author", null, DateTime.Now, blog.Id, e.Id);
            InsertNewMetaTag("One more for good measure", "description", null, DateTime.Now, blog.Id, e.Id);
            InsertNewMetaTag("no-cache", null, "cache-control", DateTime.Now, blog.Id, e.Id);
            InsertNewMetaTag("Mon, 22 Jul 2022 11:12:01 GMT", null, "expires", DateTime.Now, blog.Id, e.Id);

            IList<MetaTag> tags = MetaTags.GetMetaTagsForEntry(e, 0, 100);

            Assert.AreEqual(4, tags.Count, "Should have found 4 MetaTags for this entry.");
        }
コード例 #18
0
ファイル: MetaTagDeleteTests.cs プロジェクト: ayende/Subtext
        public void CanDeleteEntryMetaTag()
        {
            blog = UnitTestHelper.CreateBlogAndSetupContext();
            Entry entry =
                UnitTestHelper.CreateEntryInstanceForSyndication("Steven Harman", "Sweet arse entry!",
                                                                 "Giddy, giddy, goo!");
            Entries.Create(entry);

            MetaTag tag = UnitTestHelper.BuildMetaTag("Foo, bar, zaa?", "author", null, blog.Id, entry.Id, DateTime.Now);
            MetaTags.Create(tag);

            Assert.AreEqual(1, MetaTags.GetMetaTagsForBlog(blog, 0, 100).Count, "Should be one (1) MetaTag for this blog.");
            Assert.AreEqual(1, MetaTags.GetMetaTagsForEntry(entry, 0, 100).Count, "Should be one (1) MetaTag for this entry.");

            // Now let's remove it from the data store
            Assert.IsTrue(MetaTags.Delete(tag.Id), "Deleting the MetaTag failed.");

            Assert.AreEqual(0, MetaTags.GetMetaTagsForBlog(blog, 0, 100).Count, "Should be zero (0) MetaTags for this blog.");
            Assert.AreEqual(0, MetaTags.GetMetaTagsForEntry(entry, 0, 100).Count, "Should be zero (0) MetaTag for this entry.");
        }
コード例 #19
0
ファイル: EncosureDeleteTests.cs プロジェクト: ayende/Subtext
        public void CanDeleteEnclosure()
        {
            blog = UnitTestHelper.CreateBlogAndSetupContext();

            Entry e = UnitTestHelper.CreateEntryInstanceForSyndication("Simone Chiaretta", "Post for testing Enclosures", "Listen to my great podcast");
            int entryId = Entries.Create(e);

            Enclosure enc = UnitTestHelper.BuildEnclosure("Nothing to see here.", "httP://blablabla.com", "audio/mp3", entryId, 12345678, true, true);
            Enclosures.Create(enc);

            Entry newEntry = Entries.GetEntry(entryId, false);

            Assert.IsNotNull(newEntry.Enclosure, "Did not create enclosure.");

            Enclosures.Delete(enc.Id);

            Entry newEntry1 = Entries.GetEntry(entryId, false);

            Assert.IsNull(newEntry1.Enclosure, "Did not delete enclosure.");
        }
コード例 #20
0
ファイル: RsdHandlerTests.cs プロジェクト: ayende/Subtext
        public void WriteRsdWritesTheCorrectRSD(string host, string application, string subfolder, string expected)
        {
            StringBuilder builder = new StringBuilder();
            XmlWriter writer = XmlWriter.Create(builder);
            RsdHandler handler = new RsdHandler();

            BlogInfo blog = new BlogInfo();
            blog.Id = 8675309;
            blog.Subfolder = subfolder;
            blog.Host = host;
            UnitTestHelper.SetHttpContextWithBlogRequest(host, subfolder, application);

            HttpContext.Current.Cache["BlogInfo-" + host + "/" + subfolder] = blog;

            handler.WriteRsd(writer, blog);

            //Now lets assert some things.
            XmlDocument xml = new XmlDocument();
            Console.WriteLine(builder);
            xml.LoadXml(builder.ToString());

            XmlNamespaceManager nsmgr = new XmlNamespaceManager(xml.NameTable);
            nsmgr.AddNamespace("rsd", "http://archipelago.phrasewise.com/rsd");

            XmlNode rootRsdNode = xml.SelectSingleNode("/rsd:rsd", nsmgr);
            Assert.IsNotNull(rootRsdNode, "Could not find the root RSD node.");
            Assert.AreEqual("1.0", rootRsdNode.Attributes["version"].InnerText, "Expected the version attribute to be '1.0'");

            XmlNode engineNameNode = xml.SelectSingleNode("/rsd:rsd/rsd:service/rsd:engineName", nsmgr);
            Assert.IsNotNull(engineNameNode, "Could not find the engineName node.");
            Assert.AreEqual(engineNameNode.InnerText, "Subtext");
            XmlNode node = xml.SelectSingleNode("/rsd:rsd/rsd:service/rsd:apis/rsd:api[@name='MetaWeblog']", nsmgr);
            Assert.IsNotNull(node, "Could not find the metaweblog node.");
            Assert.AreEqual(expected, node.Attributes["apiLink"].Value, "Api link is wrong");

            Assert.AreEqual("8675309", node.Attributes["blogID"].Value, "Blog Id is not set.");
        }
コード例 #21
0
        public void CommentRssWriterProducesValidFeed()
        {
            UnitTestHelper.SetHttpContextWithBlogRequest("localhost", "", "Subtext.Web");

            BlogInfo blogInfo = new BlogInfo();
            blogInfo.Host = "localhost";
            blogInfo.Email = "*****@*****.**";
            blogInfo.RFC3229DeltaEncodingEnabled = true;
            blogInfo.Title = "My Blog Rulz";
            blogInfo.TimeZoneId = PacificTimeZoneId;

            HttpContext.Current.Items.Add("BlogInfo-", blogInfo);

            Entry rootEntry = new Entry(PostType.None);
            rootEntry.AllowComments = true;
            rootEntry.Title = "Comments requiring your approval.";
            rootEntry.Url = "/Admin/Feedback.aspx?status=2";
            rootEntry.Body = "The following items are waiting approval.";
            rootEntry.PostType = PostType.None;

            Entry entry = UnitTestHelper.CreateEntryInstanceForSyndication("haacked", "title of the post", "Body of the post.");
            entry.EntryName = "titleofthepost";
            entry.DateCreated = entry.DateSyndicated = entry.DateModified = DateTime.ParseExact("2006/02/01", "yyyy/MM/dd", CultureInfo.InvariantCulture);
            entry.Url = "/archive/2006/02/01/titleofthepost.aspx";
            entry.Id = 1001;

            FeedbackItem comment = new FeedbackItem(FeedbackType.Comment);
            comment.Id = 1002;
            comment.DateCreated = comment.DateModified = DateTime.ParseExact("2006/02/01", "yyyy/MM/dd", CultureInfo.InvariantCulture);
            comment.Title = "re: titleofthepost";
            comment.ParentEntryName = entry.EntryName;
            comment.ParentDateCreated = entry.DateCreated;
            comment.Body = "<strong>I rule!</strong>";
            comment.Author = "Jane Schmane";
            comment.Email = "*****@*****.**";
            comment.EntryId = entry.Id;
            comment.Status = FeedbackStatusFlag.NeedsModeration;

            List <FeedbackItem> comments = new List<FeedbackItem>();
            comments.Add(comment);

            ModeratedCommentRssWriter writer = new ModeratedCommentRssWriter(comments, rootEntry);

            string expected = @"<rss version=""2.0"" "
                        + @"xmlns:dc=""http://purl.org/dc/elements/1.1/"" "
                        + @"xmlns:trackback=""http://madskills.com/public/xml/rss/module/trackback/"" "
                        + @"xmlns:wfw=""http://wellformedweb.org/CommentAPI/"" "
                        + @"xmlns:slash=""http://purl.org/rss/1.0/modules/slash/"" "
                        + @"xmlns:copyright=""http://blogs.law.harvard.edu/tech/rss"" "
                        + @"xmlns:image=""http://purl.org/rss/1.0/modules/image/"">" + Environment.NewLine
                    + indent() + @"<channel>" + Environment.NewLine
                            + indent(2) + @"<title>Comments requiring your approval.</title>" + Environment.NewLine
                            + indent(2) + @"<link>http://localhost/Subtext.Web/Admin/Feedback.aspx?status=2</link>" + Environment.NewLine
                            + indent(2) + @"<description>The following items are waiting approval.</description>" + Environment.NewLine
                            + indent(2) + @"<language>en-US</language>" + Environment.NewLine
                            + indent(2) + @"<copyright>Subtext Weblog</copyright>" + Environment.NewLine
                            + indent(2) + @"<generator>{0}</generator>" + Environment.NewLine
                            + indent(2) + @"<image>" + Environment.NewLine
                                + indent(3) + @"<title>Comments requiring your approval.</title>" + Environment.NewLine
                                + indent(3) + @"<url>http://localhost/Subtext.Web/images/RSS2Image.gif</url>" + Environment.NewLine
                                + indent(3) + @"<link>http://localhost/Subtext.Web/Admin/Feedback.aspx?status=2</link>" + Environment.NewLine
                                + indent(3) + @"<width>77</width>" + Environment.NewLine
                                + indent(3) + @"<height>60</height>" + Environment.NewLine
                            + indent(2) + @"</image>" + Environment.NewLine
                    + indent(2) + @"<item>" + Environment.NewLine
                            + indent(3) + @"<title>re: titleofthepost</title>" + Environment.NewLine
                            + indent(3) + @"<link>http://localhost/Subtext.Web/archive/2006/02/01/titleofthepost.aspx#1002</link>" + Environment.NewLine
                            + indent(3) + @"<description>&lt;strong&gt;I rule!&lt;/strong&gt;</description>" + Environment.NewLine
                            + indent(3) + @"<dc:creator>Jane Schmane</dc:creator>" + Environment.NewLine
                            + indent(3) + @"<guid>http://localhost/Subtext.Web/archive/2006/02/01/titleofthepost.aspx#1002</guid>" + Environment.NewLine
                            + indent(3) + @"<pubDate>Wed, 01 Feb 2006 08:00:00 GMT</pubDate>" + Environment.NewLine
                        + indent(2) + @"</item>" + Environment.NewLine
                + indent() + @"</channel>" + Environment.NewLine
              + @"</rss>";

            expected = string.Format(expected, VersionInfo.VersionDisplayText);

            Console.WriteLine("EXPECTED: " + expected);
            Console.WriteLine("ACTUAL  : " + writer.Xml);
            Assert.AreEqual(expected, writer.Xml);
        }
コード例 #22
0
ファイル: HtmlHelperTests.cs プロジェクト: ayende/Subtext
        public void SetUp()
        {
            UnitTestHelper.SetHttpContextWithBlogRequest("localhost", "MyBlog");
            BlogInfo blogInfo = new BlogInfo();
            blogInfo.Host = "localhost";
            blogInfo.Subfolder = "MyBlog";

            HttpContext.Current.Items.Add("BlogInfo-", blogInfo);
        }
コード例 #23
0
ファイル: RssWriterTests.cs プロジェクト: ayende/Subtext
        public void RssWriterHandlesRFC3229DeltaEncoding()
        {
            UnitTestHelper.SetHttpContextWithBlogRequest("localhost", "", "Subtext.Web");

            BlogInfo blogInfo = new BlogInfo();
            blogInfo.Host = "localhost";
            blogInfo.Subfolder = "";
            blogInfo.Email = "*****@*****.**";
            blogInfo.RFC3229DeltaEncodingEnabled = true;
            blogInfo.TimeZoneId = PacificTimeZoneId;

            HttpContext.Current.Items.Add("BlogInfo-", blogInfo);

            List<Entry> entries = new List<Entry>(CreateSomeEntriesDescending());
            // Tell the write we already received 1002 published 6/25/1976.
            RssWriter writer = new RssWriter(entries, DateTime.ParseExact("06/25/1976","MM/dd/yyyy",CultureInfo.InvariantCulture), true);

            // We only expect 1003 and 1004
            string expected = @"<rss version=""2.0"" xmlns:dc=""http://purl.org/dc/elements/1.1/"" xmlns:trackback=""http://madskills.com/public/xml/rss/module/trackback/"" xmlns:wfw=""http://wellformedweb.org/CommentAPI/"" xmlns:slash=""http://purl.org/rss/1.0/modules/slash/"" xmlns:copyright=""http://blogs.law.harvard.edu/tech/rss"" xmlns:image=""http://purl.org/rss/1.0/modules/image/"">" + Environment.NewLine
                                + indent() + "<channel>" + Environment.NewLine
                                    + indent(2) + "<title />" + Environment.NewLine
                                    + indent(2) + "<link>http://localhost/Subtext.Web/Default.aspx</link>" + Environment.NewLine
                                    + indent(2) + "<description />" + Environment.NewLine
                                    + indent(2) + "<language>en-US</language>" + Environment.NewLine
                                    + indent(2) + "<copyright>Subtext Weblog</copyright>" + Environment.NewLine
                                    + indent(2) + "<managingEditor>[email protected]</managingEditor>" + Environment.NewLine
                                    + indent(2) + "<generator>{0}</generator>" + Environment.NewLine
                                    + indent(2) + "<image>" + Environment.NewLine
                                        + indent(3) + "<title />" + Environment.NewLine
                                        + indent(3) + "<url>http://localhost/Subtext.Web/images/RSS2Image.gif</url>" + Environment.NewLine
                                        + indent(3) + "<link>http://localhost/Subtext.Web/Default.aspx</link>" + Environment.NewLine
                                        + indent(3) + "<width>77</width>" + Environment.NewLine
                                        + indent(3) + "<height>60</height>" + Environment.NewLine
                                    + indent(2) + "</image>" + Environment.NewLine
                                    + indent(2) + @"<item>" + Environment.NewLine
                                        + indent(3) + @"<title>Title of 1004.</title>" + Environment.NewLine
                                        + indent(3) + @"<link>http://localhost/Subtext.Web/archive/2003/07/14/1004.aspx</link>" + Environment.NewLine
                                        + indent(3) + @"<description>Body of 1004&lt;img src=""http://localhost/Subtext.Web/aggbug/1004.aspx"" width=""1"" height=""1"" /&gt;</description>" + Environment.NewLine
                                        + indent(3) + @"<dc:creator>Phil Haack</dc:creator>" + Environment.NewLine
                                        + indent(3) + @"<guid>http://localhost/Subtext.Web/archive/2003/07/14/1004.aspx</guid>" + Environment.NewLine
                                        + indent(3) + @"<pubDate>Mon, 14 Jul 2003 07:00:00 GMT</pubDate>" + Environment.NewLine
                                        + indent(3) + @"<comments>http://localhost/Subtext.Web/archive/2003/07/14/1004.aspx#feedback</comments>" + Environment.NewLine
                                        + indent(3) + @"<wfw:commentRss>http://localhost/Subtext.Web/comments/commentRss/1004.aspx</wfw:commentRss>" + Environment.NewLine
                                    + indent(2) + @"</item>" + Environment.NewLine
                                    + indent(2) + @"<item>" + Environment.NewLine
                                        + indent(3) + "<title>Title of 1003.</title>" + Environment.NewLine
                                        + indent(3) + "<link>http://localhost/Subtext.Web/archive/1979/10/16/1003.aspx</link>" + Environment.NewLine
                                        + indent(3) + @"<description>Body of 1003&lt;img src=""http://localhost/Subtext.Web/aggbug/1003.aspx"" width=""1"" height=""1"" /&gt;</description>" + Environment.NewLine
                                        + indent(3) + @"<dc:creator>Phil Haack</dc:creator>" + Environment.NewLine
                                        + indent(3) + @"<guid>http://localhost/Subtext.Web/archive/1979/10/16/1003.aspx</guid>" + Environment.NewLine
                                        + indent(3) + @"<pubDate>Tue, 16 Oct 1979 07:00:00 GMT</pubDate>" + Environment.NewLine
                                        + indent(3) + @"<comments>http://localhost/Subtext.Web/archive/1979/10/16/1003.aspx#feedback</comments>" + Environment.NewLine
                                        + indent(3) + @"<wfw:commentRss>http://localhost/Subtext.Web/comments/commentRss/1003.aspx</wfw:commentRss>" + Environment.NewLine
                                    + indent(2) + "</item>" + Environment.NewLine
                                + indent() + "</channel>" + Environment.NewLine
                              + "</rss>";

            expected = string.Format(expected, VersionInfo.VersionDisplayText);

            Assert.AreEqual(expected, writer.Xml);

            Assert.AreEqual(DateTime.ParseExact("06/25/1976","MM/dd/yyyy",CultureInfo.InvariantCulture), writer.DateLastViewedFeedItemPublished, "The Item ID Last Viewed (according to If-None-Since is wrong.");
            Assert.AreEqual(DateTime.ParseExact("07/14/2003","MM/dd/yyyy",CultureInfo.InvariantCulture), writer.LatestPublishDate, "The Latest Feed Item ID sent to the client is wrong.");
        }
コード例 #24
0
ファイル: RssWriterTests.cs プロジェクト: ayende/Subtext
        public void RssWriterSendsWholeFeedWhenRFC3229Disabled()
        {
            UnitTestHelper.SetHttpContextWithBlogRequest("localhost", "", "Subtext.Web");

            BlogInfo blogInfo = new BlogInfo();
            blogInfo.Host = "localhost";
            blogInfo.Subfolder = "";
            blogInfo.Email = "*****@*****.**";
            blogInfo.RFC3229DeltaEncodingEnabled = false;
            blogInfo.TimeZoneId = PacificTimeZoneId;

            HttpContext.Current.Items.Add("BlogInfo-", blogInfo);

            List<Entry> entries = new List<Entry>(CreateSomeEntriesDescending());
            RssWriter writer = new RssWriter(entries, DateTime.ParseExact("07/14/2003", "MM/dd/yyyy", CultureInfo.InvariantCulture), false);

            string expected = @"<rss version=""2.0"" xmlns:dc=""http://purl.org/dc/elements/1.1/"" xmlns:trackback=""http://madskills.com/public/xml/rss/module/trackback/"" xmlns:wfw=""http://wellformedweb.org/CommentAPI/"" xmlns:slash=""http://purl.org/rss/1.0/modules/slash/"" xmlns:copyright=""http://blogs.law.harvard.edu/tech/rss"" xmlns:image=""http://purl.org/rss/1.0/modules/image/"">" + Environment.NewLine
                                + indent() + "<channel>" + Environment.NewLine
                                    + indent(2) + "<title />" + Environment.NewLine
                                    + indent(2) + "<link>http://localhost/Subtext.Web/Default.aspx</link>" + Environment.NewLine
                                    + indent(2) + "<description />" + Environment.NewLine
                                    + indent(2) + "<language>en-US</language>" + Environment.NewLine
                                    + indent(2) + "<copyright>Subtext Weblog</copyright>" + Environment.NewLine
                                    + indent(2) + "<managingEditor>[email protected]</managingEditor>" + Environment.NewLine
                                    + indent(2) + "<generator>{0}</generator>" + Environment.NewLine
                                    + indent(2) + "<image>" + Environment.NewLine
                                        + indent(3) + "<title />" + Environment.NewLine
                                        + indent(3) + "<url>http://localhost/Subtext.Web/images/RSS2Image.gif</url>" + Environment.NewLine
                                        + indent(3) + "<link>http://localhost/Subtext.Web/Default.aspx</link>" + Environment.NewLine
                                        + indent(3) + "<width>77</width>" + Environment.NewLine
                                        + indent(3) + "<height>60</height>" + Environment.NewLine
                                    + indent(2) + "</image>" + Environment.NewLine
                                    + indent(2) + @"<item>" + Environment.NewLine
                                        + indent(3) + "<title>Title of 1004.</title>" + Environment.NewLine
                                        + indent(3) + "<link>http://localhost/Subtext.Web/archive/2003/07/14/1004.aspx</link>" + Environment.NewLine
                                        + indent(3) + @"<description>Body of 1004&lt;img src=""http://localhost/Subtext.Web/aggbug/1004.aspx"" width=""1"" height=""1"" /&gt;</description>" + Environment.NewLine
                                        + indent(3) + "<dc:creator>Phil Haack</dc:creator>" + Environment.NewLine
                                        + indent(3) + "<guid>http://localhost/Subtext.Web/archive/2003/07/14/1004.aspx</guid>" + Environment.NewLine
                                        + indent(3) + "<pubDate>Mon, 14 Jul 2003 07:00:00 GMT</pubDate>" + Environment.NewLine
                                        + indent(3) + "<comments>http://localhost/Subtext.Web/archive/2003/07/14/1004.aspx#feedback</comments>" + Environment.NewLine
                                        + indent(3) + "<wfw:commentRss>http://localhost/Subtext.Web/comments/commentRss/1004.aspx</wfw:commentRss>" + Environment.NewLine
                                    + indent(2) + "</item>" + Environment.NewLine
                                    + indent(2) + "<item>" + Environment.NewLine
                                        + indent(3) + "<title>Title of 1003.</title>" + Environment.NewLine
                                        + indent(3) + @"<link>http://localhost/Subtext.Web/archive/1979/10/16/1003.aspx</link>" + Environment.NewLine
                                        + indent(3) + @"<description>Body of 1003&lt;img src=""http://localhost/Subtext.Web/aggbug/1003.aspx"" width=""1"" height=""1"" /&gt;</description>" + Environment.NewLine
                                        + indent(3) + "<dc:creator>Phil Haack</dc:creator>" + Environment.NewLine
                                        + indent(3) + "<guid>http://localhost/Subtext.Web/archive/1979/10/16/1003.aspx</guid>" + Environment.NewLine
                                        + indent(3) + "<pubDate>Tue, 16 Oct 1979 07:00:00 GMT</pubDate>" + Environment.NewLine
                                        + indent(3) + "<comments>http://localhost/Subtext.Web/archive/1979/10/16/1003.aspx#feedback</comments>" + Environment.NewLine
                                        + indent(3) + "<wfw:commentRss>http://localhost/Subtext.Web/comments/commentRss/1003.aspx</wfw:commentRss>" + Environment.NewLine
                                    + indent(2) + "</item>" + Environment.NewLine
                                    + indent(2) + @"<item>" + Environment.NewLine
                                        + indent(3) + "<title>Title of 1002.</title>" + Environment.NewLine
                                        + indent(3) + "<link>http://localhost/Subtext.Web/archive/1976/06/25/1002.aspx</link>" + Environment.NewLine
                                        + indent(3) + @"<description>Body of 1002&lt;img src=""http://localhost/Subtext.Web/aggbug/1002.aspx"" width=""1"" height=""1"" /&gt;</description>" + Environment.NewLine
                                        + indent(3) + "<dc:creator>Phil Haack</dc:creator>" + Environment.NewLine
                                        + indent(3) + "<guid>http://localhost/Subtext.Web/archive/1976/06/25/1002.aspx</guid>" + Environment.NewLine
                                        + indent(3) + "<pubDate>Fri, 25 Jun 1976 07:00:00 GMT</pubDate>" + Environment.NewLine
                                        + indent(3) + "<comments>http://localhost/Subtext.Web/archive/1976/06/25/1002.aspx#feedback</comments>" + Environment.NewLine
                                        + indent(3) + "<wfw:commentRss>http://localhost/Subtext.Web/comments/commentRss/1002.aspx</wfw:commentRss>" + Environment.NewLine
                                    + indent(2) + "</item>" + Environment.NewLine
                                    + indent(2) + @"<item>" + Environment.NewLine
                                        + indent(3) + "<title>Title of 1001.</title>" + Environment.NewLine
                                        + indent(3) + "<link>http://localhost/Subtext.Web/archive/1975/02/23/1001.aspx</link>" + Environment.NewLine
                                        + indent(3) + @"<description>Body of 1001&lt;img src=""http://localhost/Subtext.Web/aggbug/1001.aspx"" width=""1"" height=""1"" /&gt;</description>" + Environment.NewLine
                                        + indent(3) + "<dc:creator>Phil Haack</dc:creator>" + Environment.NewLine
                                        + indent(3) + "<guid>http://localhost/Subtext.Web/archive/1975/02/23/1001.aspx</guid>" + Environment.NewLine
                                        + indent(3) + "<pubDate>Sun, 23 Feb 1975 08:00:00 GMT</pubDate>" + Environment.NewLine
                                        + indent(3) + "<comments>http://localhost/Subtext.Web/archive/1975/02/23/1001.aspx#feedback</comments>" + Environment.NewLine
                                        + indent(3) + "<wfw:commentRss>http://localhost/Subtext.Web/comments/commentRss/1001.aspx</wfw:commentRss>" + Environment.NewLine
                                    + indent(2) + "</item>" + Environment.NewLine
                                + indent() + "</channel>" + Environment.NewLine
                              + "</rss>";
            expected = string.Format(expected, VersionInfo.VersionDisplayText);
            UnitTestHelper.AssertStringsEqualCharacterByCharacter(expected, writer.Xml);
        }
コード例 #25
0
ファイル: RssWriterTests.cs プロジェクト: ayende/Subtext
        public void RssWriterProducesValidFeed()
        {
            UnitTestHelper.SetHttpContextWithBlogRequest("localhost", "", "Subtext.Web");

            BlogInfo blogInfo = new BlogInfo();
            blogInfo.Host = "localhost";
            blogInfo.Title = "My Blog Is Better Than Yours";
            blogInfo.Email = "*****@*****.**";
            blogInfo.RFC3229DeltaEncodingEnabled = true;
            blogInfo.TimeZoneId = PacificTimeZoneId;

            HttpContext.Current.Items.Add("BlogInfo-", blogInfo);

            List<Entry> entries = new List<Entry>(CreateSomeEntries());
            entries[0].Categories.AddRange(new string[] { "Category1", "Category2" });
            entries[0].Email = "*****@*****.**";
            entries[2].Categories.Add("Category 3");

            Enclosure enc = new Enclosure();

            enc.Url = "http://perseus.franklins.net/hanselminutes_0107.mp3";
            enc.Title = "<Digital Photography Explained (for Geeks) with Aaron Hockley/>";
            enc.Size = 26707573;
            enc.MimeType = "audio/mp3";
            enc.AddToFeed = true;

            entries[2].Enclosure = enc;

            Enclosure enc1 = new Enclosure();

            enc1.Url = "http://perseus.franklins.net/hanselminutes_0107.mp3";
            enc1.Title = "<Digital Photography Explained (for Geeks) with Aaron Hockley/>";
            enc1.Size = 26707573;
            enc1.MimeType = "audio/mp3";
            enc1.AddToFeed = false;

            entries[3].Enclosure = enc1;

            RssWriter writer = new RssWriter(entries, NullValue.NullDateTime, false);

            string expected = @"<rss version=""2.0"" "
                                    + @"xmlns:dc=""http://purl.org/dc/elements/1.1/"" "
                                    + @"xmlns:trackback=""http://madskills.com/public/xml/rss/module/trackback/"" "
                                    + @"xmlns:wfw=""http://wellformedweb.org/CommentAPI/"" "
                                    + @"xmlns:slash=""http://purl.org/rss/1.0/modules/slash/"" "
                                    + @"xmlns:copyright=""http://blogs.law.harvard.edu/tech/rss"" "
                                    + @"xmlns:image=""http://purl.org/rss/1.0/modules/image/"">" + Environment.NewLine
                                + indent() + @"<channel>" + Environment.NewLine
                                        + indent(2) + @"<title>My Blog Is Better Than Yours</title>" + Environment.NewLine
                                        + indent(2) + @"<link>http://localhost/Subtext.Web/Default.aspx</link>" + Environment.NewLine
                                        + indent(2) + @"<description />" + Environment.NewLine
                                        + indent(2) + @"<language>en-US</language>" + Environment.NewLine
                                        + indent(2) + @"<copyright>Subtext Weblog</copyright>" + Environment.NewLine
                                        + indent(2) + @"<managingEditor>[email protected]</managingEditor>" + Environment.NewLine
                                        + indent(2) + @"<generator>{0}</generator>" + Environment.NewLine
                                        + indent(2) + @"<image>" + Environment.NewLine
                                            + indent(3) + @"<title>My Blog Is Better Than Yours</title>" + Environment.NewLine
                                            + indent(3) + @"<url>http://localhost/Subtext.Web/images/RSS2Image.gif</url>" + Environment.NewLine
                                            + indent(3) + @"<link>http://localhost/Subtext.Web/Default.aspx</link>" + Environment.NewLine
                                            + indent(3) + @"<width>77</width>" + Environment.NewLine
                                            + indent(3) + @"<height>60</height>" + Environment.NewLine
                                        + indent(2) + @"</image>" + Environment.NewLine
                                        + indent(2) + @"<item>" + Environment.NewLine
                                            + indent(3) + @"<title>Title of 1001.</title>" + Environment.NewLine
                                            + indent(3) + @"<category>Category1</category>" + Environment.NewLine
                                            + indent(3) + @"<category>Category2</category>" + Environment.NewLine
                                            + indent(3) + @"<link>http://localhost/Subtext.Web/archive/1975/02/23/1001.aspx</link>" + Environment.NewLine
                                            + indent(3) + @"<description>Body of 1001&lt;img src=""http://localhost/Subtext.Web/aggbug/1001.aspx"" width=""1"" height=""1"" /&gt;</description>" + Environment.NewLine
                                            + indent(3) + @"<dc:creator>Phil Haack</dc:creator>" + Environment.NewLine
                                            + indent(3) + @"<guid>http://localhost/Subtext.Web/archive/1975/02/23/1001.aspx</guid>" + Environment.NewLine
                                            + indent(3) + @"<pubDate>Sun, 23 Feb 1975 08:00:00 GMT</pubDate>" + Environment.NewLine
                                            + indent(3) + @"<comments>http://localhost/Subtext.Web/archive/1975/02/23/1001.aspx#feedback</comments>" + Environment.NewLine
                                            + indent(3) + @"<wfw:commentRss>http://localhost/Subtext.Web/comments/commentRss/1001.aspx</wfw:commentRss>" + Environment.NewLine
                                        + indent(2) + @"</item>" + Environment.NewLine
                                        + indent(2) + @"<item>" + Environment.NewLine
                                            + indent(3) + @"<title>Title of 1002.</title>" + Environment.NewLine
                                            + indent(3) + @"<link>http://localhost/Subtext.Web/archive/1976/06/25/1002.aspx</link>" + Environment.NewLine
                                            + indent(3) + @"<description>Body of 1002&lt;img src=""http://localhost/Subtext.Web/aggbug/1002.aspx"" width=""1"" height=""1"" /&gt;</description>" + Environment.NewLine
                                            + indent(3) + @"<dc:creator>Phil Haack</dc:creator>" + Environment.NewLine
                                            + indent(3) + @"<guid>http://localhost/Subtext.Web/archive/1976/06/25/1002.aspx</guid>" + Environment.NewLine
                                            + indent(3) + @"<pubDate>Fri, 25 Jun 1976 07:00:00 GMT</pubDate>" + Environment.NewLine
                                            + indent(3) + @"<comments>http://localhost/Subtext.Web/archive/1976/06/25/1002.aspx#feedback</comments>" + Environment.NewLine
                                            + indent(3) + @"<wfw:commentRss>http://localhost/Subtext.Web/comments/commentRss/1002.aspx</wfw:commentRss>" + Environment.NewLine
                                        + indent(2) + @"</item>" + Environment.NewLine
                                        + indent(2) + @"<item>" + Environment.NewLine
                                            + indent(3) + @"<title>Title of 1003.</title>" + Environment.NewLine
                                            + indent(3) + @"<category>Category 3</category>" + Environment.NewLine
                                            + indent(3) + @"<link>http://localhost/Subtext.Web/archive/1979/10/16/1003.aspx</link>" + Environment.NewLine
                                            + indent(3) + @"<description>Body of 1003&lt;img src=""http://localhost/Subtext.Web/aggbug/1003.aspx"" width=""1"" height=""1"" /&gt;</description>" + Environment.NewLine
                                            + indent(3) + @"<dc:creator>Phil Haack</dc:creator>" + Environment.NewLine
                                            + indent(3) + @"<guid>http://localhost/Subtext.Web/archive/1979/10/16/1003.aspx</guid>" + Environment.NewLine
                                            + indent(3) + @"<pubDate>Tue, 16 Oct 1979 07:00:00 GMT</pubDate>" + Environment.NewLine
                                            + indent(3) + @"<comments>http://localhost/Subtext.Web/archive/1979/10/16/1003.aspx#feedback</comments>" + Environment.NewLine
                                            + indent(3) + @"<wfw:commentRss>http://localhost/Subtext.Web/comments/commentRss/1003.aspx</wfw:commentRss>" + Environment.NewLine
                                            + indent(3) + @"<enclosure url=""http://perseus.franklins.net/hanselminutes_0107.mp3"" length=""26707573"" type=""audio/mp3"" />" + Environment.NewLine
                                        + indent(2) + @"</item>" + Environment.NewLine
                                        + indent(2) + @"<item>" + Environment.NewLine
                                            + indent(3) + @"<title>Title of 1004.</title>" + Environment.NewLine
                                            + indent(3) + @"<link>http://localhost/Subtext.Web/archive/2003/07/14/1004.aspx</link>" + Environment.NewLine
                                            + indent(3) + @"<description>Body of 1004&lt;img src=""http://localhost/Subtext.Web/aggbug/1004.aspx"" width=""1"" height=""1"" /&gt;</description>" + Environment.NewLine
                                            + indent(3) + @"<dc:creator>Phil Haack</dc:creator>" + Environment.NewLine
                                            + indent(3) + @"<guid>http://localhost/Subtext.Web/archive/2003/07/14/1004.aspx</guid>" + Environment.NewLine
                                            + indent(3) + @"<pubDate>Mon, 14 Jul 2003 07:00:00 GMT</pubDate>" + Environment.NewLine
                                            + indent(3) + @"<comments>http://localhost/Subtext.Web/archive/2003/07/14/1004.aspx#feedback</comments>" + Environment.NewLine
                                            + indent(3) + @"<wfw:commentRss>http://localhost/Subtext.Web/comments/commentRss/1004.aspx</wfw:commentRss>" + Environment.NewLine
                                        + indent(2) + @"</item>" + Environment.NewLine
                                + indent() + @"</channel>" + Environment.NewLine
                              + @"</rss>";

            expected = string.Format(expected, VersionInfo.VersionDisplayText);

            Console.WriteLine(expected);
            Console.WriteLine(writer.Xml);
            UnitTestHelper.AssertStringsEqualCharacterByCharacter(expected, writer.Xml);
        }
コード例 #26
0
ファイル: ImageTests.cs プロジェクト: ayende/Subtext
 private static Image CreateImageInstance(BlogInfo currentBlog, int categoryId)
 {
     Image image = CreateStandaloneImageInstance();
     image.BlogId = currentBlog.Id;
     image.CategoryID = categoryId;
     return image;
 }
コード例 #27
0
ファイル: BaseControl.cs プロジェクト: ayende/Subtext
 protected override void OnInit(EventArgs e)
 {
     _config = Config.CurrentBlog;
     base.OnInit (e);
 }
コード例 #28
0
ファイル: MetaTagGetTests.cs プロジェクト: ayende/Subtext
 public void GetReturnsZeroWhenNoMetaTagsExistForBlog()
 {
     this.blog = UnitTestHelper.CreateBlogAndSetupContext();
     Assert.AreEqual(0, MetaTags.GetMetaTagsForBlog(blog, 0, 100).Count, "Shouldn't have found any MetaTags for this blog.");
 }
コード例 #29
0
ファイル: MetaTagGetTests.cs プロジェクト: ayende/Subtext
        public void GetReturnsZeroWhenNoMetaTagsExistForEntry()
        {
            this.blog = UnitTestHelper.CreateBlogAndSetupContext();

            Entry e =
                UnitTestHelper.CreateEntryInstanceForSyndication("Steve Harman", "Loves Subtexting!", "Roses are red...");
            Entries.Create(e);

            Assert.AreEqual(0, MetaTags.GetMetaTagsForEntry(e, 0, 100).Count, "Shouldn't have found any MetaTags for this entry.");
        }
コード例 #30
0
ファイル: MetaTags.cs プロジェクト: ayende/Subtext
 public static IPagedCollection<MetaTag> GetMetaTagsForBlog(BlogInfo blog, int pageIndex, int pageSize)
 {
     return ObjectProvider.Instance().GetMetaTagsForBlog(blog, pageIndex, pageSize);
 }