Exemplo n.º 1
0
        private string ExecuteView(StubViewData viewData)
        {
            var view = FastActivator <StubSparkView> .New(_compiler.CompiledType);

            _languageFactory.InstanceCreated(_compiler, view);
            view.ViewData = viewData;
            var contents = new StringWriter();

            view.RenderView(contents);
            _languageFactory.InstanceReleased(_compiler, view);
            return(contents.ToString());
        }
Exemplo n.º 2
0
        public void CreatedViewHasScriptProperty()
        {
            var chunks = Chunks(new SendLiteralChunk {
                Text = "Hello"
            });

            _compiler.CompileView(chunks, chunks);
            var view = FastActivator <IScriptingSparkView> .New(_compiler.CompiledType);

            var source = _compiler.SourceCode;
            var script = view.ScriptSource;

            Assert.IsNotNull(source);
            Assert.IsNotEmpty(source);
            Assert.IsNotNull(script);
            Assert.IsNotEmpty(script);
        }