コード例 #1
0
ファイル: OpmlWriterTests.cs プロジェクト: rhoadsce/Subtext
        public void OpmlWriter_WithTwoBlogs_RendersCorrectIndentedOpml()
        {
            //arrange
            var blogs = new[]
            {
                new Blog {Id = 1, Host = "example.com", Subfolder = "blog1", Title = "example blog"},
                new Blog {Id = 2, Host = "haacked.com", Title = "You've Been Haacked"}
            };
            var writer = new StringWriter();
            var urlHelper = new Mock<BlogUrlHelper>();
            urlHelper.Setup(u => u.RssUrl(blogs[0])).Returns(new Uri("http://example.com/blog1/Rss.aspx"));
            urlHelper.Setup(u => u.RssUrl(blogs[1])).Returns(new Uri("http://haacked.com/Rss.aspx"));
            var opml = new OpmlWriter();

            //act
            opml.Write(blogs, writer, urlHelper.Object);

            //assert
            const string expected =
                @"<opml version=""1.0"">
            <head>
            <title>A Subtext Community</title>
            </head>
            <body>
            <outline text=""A Subtext Community Feeds"">
            <outline type=""rss"" text=""example blog"" xmlUrl=""http://example.com/blog1/Rss.aspx"" />
            <outline type=""rss"" text=""You've Been Haacked"" xmlUrl=""http://haacked.com/Rss.aspx"" />
            </outline>
            </body>
            </opml>";

            UnitTestHelper.AssertStringsEqualCharacterByCharacter(expected, writer.ToString());
            Assert.AreEqual(expected, writer.ToString());
        }
コード例 #2
0
 public OpmlHandler(ISubtextContext subtextContext, OpmlWriter writer) : base(subtextContext)
 {
     OpmlWriter = writer;
 }
コード例 #3
0
ファイル: OpmlHandler.cs プロジェクト: rsaladrigas/Subtext
 public OpmlHandler(ISubtextContext subtextContext, OpmlWriter writer, LazyNotNull<HostInfo> hostInfo)
     : base(subtextContext)
 {
     OpmlWriter = writer;
     _hostInfo = hostInfo;
 }
コード例 #4
0
ファイル: OpmlHandler.cs プロジェクト: ghjigan/Subtext
 public OpmlHandler(ISubtextContext subtextContext, OpmlWriter writer, LazyNotNull <HostInfo> hostInfo)
     : base(subtextContext)
 {
     OpmlWriter = writer;
     _hostInfo  = hostInfo;
 }
コード例 #5
0
ファイル: OpmlHandler.cs プロジェクト: ChrisPelatari/SubText
 public OpmlHandler(ISubtextContext subtextContext, OpmlWriter writer)
     : base(subtextContext)
 {
     OpmlWriter = writer;
 }