public void Index_ReturnsManifestWithProperAdminUrls()
        {
            // arrange
            var urlHelper = new Mock<UrlHelper>();
            urlHelper.Setup(u => u.AdminUrl("")).Returns("/admin/default.aspx");
            urlHelper.Setup(u => u.AdminUrl("posts/edit.aspx")).Returns("/admin/posts/edit.aspx");
            var subtextContext = new Mock<ISubtextContext>();
            subtextContext.Setup(c => c.Blog).Returns(new Blog { Host = "localhost" });
            subtextContext.Setup(c => c.UrlHelper).Returns(urlHelper.Object);
            var controller = new ManifestController(subtextContext.Object);

            // act
            var manifest = controller.Index() as ContentResult;

            // assert
            string expected =
                @"<adminUrl>
              <![CDATA[
            http://localhost/admin/default.aspx
            ]]>
            </adminUrl>
            <postEditingUrl>
              <![CDATA[
            http://localhost/admin/posts/edit.aspx
            ]]>
            </postEditingUrl>";

            Assert.Contains(manifest.Content, expected);
        }
        public void Index_WithBlogAllowingTrackbacks_ReturnsManifestWithSupportsTrackbacksYes()
        {
            // arrange
            var urlHelper = new Mock<UrlHelper>();
            urlHelper.Setup(u => u.AdminUrl(It.IsAny<string>())).Returns("/");
            var subtextContext = new Mock<ISubtextContext>();
            subtextContext.Setup(c => c.Blog).Returns(new Blog { Host = "localhost", TrackbacksEnabled = true });
            subtextContext.Setup(c => c.UrlHelper).Returns(urlHelper.Object);
            var controller = new ManifestController(subtextContext.Object);

            // act
            var manifest = controller.Index() as ContentResult;

            // assert
            Assert.Contains(manifest.Content, "<supportsTrackbacks>Yes</supportsTrackbacks>");
        }
        public void Index_ReturnsContentWithContentTypeTextXml()
        {
            // arrange
            var urlHelper = new Mock<UrlHelper>();
            urlHelper.Setup(u => u.AdminUrl(It.IsAny<string>())).Returns("/");
            var subtextContext = new Mock<ISubtextContext>();
            subtextContext.Setup(c => c.Blog).Returns(new Blog {Host = "localhost"});
            subtextContext.Setup(c => c.UrlHelper).Returns(urlHelper.Object);
            var controller = new ManifestController(subtextContext.Object);

            // act
            var manifest = controller.Index() as ContentResult;

            // assert
            Assert.AreEqual("text/xml", manifest.ContentType);
        }