protected override void Visit(RenderPartialChunk chunk)
 {
     EnterRenderPartial(chunk);
     Accept(chunk.FileContext.Contents);
     ExitRenderPartial(chunk);
 }
Example #2
0
        public void RenderPartialWithSectionContent()
        {
            var partial = Chunks(
                new SendLiteralChunk { Text = "[" },
                new RenderSectionChunk { Name = "foo" },
                new SendLiteralChunk { Text = "]" });


            var renderPartial = new RenderPartialChunk { FileContext = new FileContext { Contents = partial[0] } };
            renderPartial.Sections.Add("foo",
                                       new[]
                                       {
                                           (Chunk) new SendLiteralChunk {Text = "From inside caller"}
                                       });

            var chunks = Chunks(
                new SendLiteralChunk { Text = "(" },
                renderPartial,
                new SendLiteralChunk { Text = ")" });

            _compiler.CompileView(chunks, new[] { chunks[0], partial[0] });
            var contents = ExecuteView();
            Assert.AreEqual("([From inside caller])", contents);
        }
Example #3
0
 protected override void Visit(RenderPartialChunk chunk)
 {
     var priorOuterPartial = OuterPartial;
     OuterPartial = chunk;
     Accept(chunk.FileContext.Contents);
     OuterPartial = priorOuterPartial;
 }