Exemplo n.º 1
0
        public void Ctor_WithBlogMLSource_SetsSource()
        {
            // arrange
            var source = new Mock<IBlogMLSource>();

            // act
            var controller = new ExportController(source.Object, new Blog {Title = "whatever"});

            // assert
            Assert.AreEqual(source.Object, controller.Source);
        }
Exemplo n.º 2
0
        public void ExportBlogML_WithBlogTitle_SetsFileDownloadNameToTitle()
        {
            // arrange
            var source = new Mock<IBlogMLSource>();
            var controller = new ExportController(source.Object, new Blog { Title = "whatever" });

            // act
            var result = controller.BlogML(false /*embedAttachments*/) as ExportActionResult;

            // assert
            Assert.AreEqual("whatever-Export.xml", result.FileDownloadName);
        }
Exemplo n.º 3
0
        public void ExportBlogML_WithBlogTitleHavingIllegalFileNameCharacters_RemovesThoseCharactersFromFileDownloadName()
        {
            // arrange
            var source = new Mock<IBlogMLSource>();
            var controller = new ExportController(source.Object, new Blog { Title = @"whatever \|/ you say" });

            // act
            var result = controller.BlogML(false /*embedAttachments*/) as ExportActionResult;

            // assert
            Assert.AreEqual("whatever  you say-Export.xml", result.FileDownloadName);
        }
Exemplo n.º 4
0
        public void ExportBlogML_WithEmbedAttachmetsTrue_ReturnsExportActionResultWithEmbedTrue()
        {
            // arrange
            var source = new Mock<IBlogMLSource>();
            var controller = new ExportController(source.Object, new Blog { Title = "whatever" });

            // act
            var result = controller.BlogML(true /*embedAttachments*/) as ExportActionResult;

            // assert
            var writer = result.BlogMLWriter as BlogMLWriter;
            Assert.IsTrue(writer.EmbedAttachments);
        }