Ejemplo n.º 1
0
        public void GetCompiledView_should_render_to_stream()
        {
            // Given
            var location = new ViewLocationResult(
                string.Empty,
                "django",
                new StringReader(@"{% ifequal a a %}<h1>Hello Mr. test</h1>{% endifequal %}")
                );

            var stream = new MemoryStream();

            // When
            var action = engine.RenderView(location, null);

            action.Invoke(stream);

            // Then
            stream.ShouldEqual("<h1>Hello Mr. test</h1>");
        }
Ejemplo n.º 2
0
        public void GetCompiledView_should_render_to_stream()
        {
            // Given
            var location = new ViewLocationResult(
                string.Empty,
                string.Empty,
                "django",
                () => new StringReader(@"{% ifequal a a %}<h1>Hello Mr. test</h1>{% endifequal %}")
                );

            A.CallTo(() => this.renderContext.LocateView(".django", null)).Returns(location);

            var stream = new MemoryStream();

            // When
            var response = engine.RenderView(location, null, this.renderContext);

            response.Contents.Invoke(stream);

            // Then
            stream.ShouldEqual("<h1>Hello Mr. test</h1>");
        }