public void RenderUsesCorrectlyNamedViewFromResolverToWriteToWriter()
        {
            string viewName = "fooView";
            var viewData = new {X = "b", Y = new {A = "C"}};
            var sparkViewResolver = MockRepository.GenerateStub<ISparkViewResolver>();
            ISparkView sparkview = MockRepository.GenerateStub<ISparkView>();
            sparkViewResolver.Stub(x => x.Create(viewName, viewData)).Return(sparkview);
            var configuration = new Dictionary<string, string> {{"TemplateName", viewName}};
            var sparkRenderer = new SparkRendererBuilder().With(sparkViewResolver).Build();
            TextWriter writer = MockRepository.GenerateStub<TextWriter>();

            sparkRenderer.Render(viewData, writer, configuration);

            sparkview.AssertWasCalled(x=>x.RenderView(writer));
        }
Exemplo n.º 2
0
        public void RenderUsesCorrectlyNamedViewFromResolverToWriteToWriter()
        {
            string     viewName          = "fooView";
            var        viewData          = new { X = "b", Y = new { A = "C" } };
            var        sparkViewResolver = MockRepository.GenerateStub <ISparkViewResolver>();
            ISparkView sparkview         = MockRepository.GenerateStub <ISparkView>();

            sparkViewResolver.Stub(x => x.Create(viewName, viewData)).Return(sparkview);
            var configuration = new Dictionary <string, string> {
                { "TemplateName", viewName }
            };
            var        sparkRenderer = new SparkRendererBuilder().With(sparkViewResolver).Build();
            TextWriter writer        = MockRepository.GenerateStub <TextWriter>();

            sparkRenderer.Render(viewData, writer, configuration);

            sparkview.AssertWasCalled(x => x.RenderView(writer));
        }