Ejemplo n.º 1
0
        static void Main()
        {
            var yate = new YateRenderer();

            var outHtml = yate.Render(@"\Data\test-01.html", new {});
            Console.WriteLine(outHtml);

            Console.WriteLine("\n...Hit Any Key To Exit...\n");
            Console.ReadLine();
        }
Ejemplo n.º 2
0
        public void RenderToString()
        {
            var parsedViewMock = new Mock<IParsedView>();
            var dataMock = new Mock<IYateDataContext>().Object;
            parsedViewMock.Setup(pv => pv.Render(dataMock))
                          .Returns(() => Helpers.EmptyHtmlString);

            parsedViewMock.Setup(pv => pv.WriteToTextWriter(It.IsAny<TextWriter>(), It.IsAny<IYateDataContext>()))
                          .Callback((TextWriter tw, IYateDataContext data) => tw.Write(Helpers.EmptyHtmlString));

            var builder = new Mock<IViewBuilder>();
            builder.Setup(b => b.Build(It.IsAny<string>())).Returns(parsedViewMock.Object);

            var renderer = new YateRenderer(builder.Object);

            var str = renderer.Render("", dataMock);

            Assert.AreEqual(Helpers.EmptyHtmlString, str);
        }