public void SetUp()
        {
            var placeholder1 = new Placeholder("area 1");
            var placeholder2 = new Placeholder("area 2");
            var widgetSpecification = new WidgetSpecification("widget");
            widgetSpecification.Insert(0, placeholder1);
            widgetSpecification.Insert(1, placeholder2);

            var area = new Area("area 1");
            var widget = new Widget("widget", new[] { area });

            var buildContext = new BuildData(Enumerable.Empty<IContextItem>());

            var builder = new Builder(RenderingInstructions.BuildForPreview(), w => widgetSpecification, null);

            var instance = widget.Build(builder, new[] { 0 }, buildContext);

            var rendererFactory = MockRepository.GenerateStub<IRendererFactory>();
            this.viewHelper = MockRepository.GenerateStub<IViewHelper>();
            var multiRenderer = new MultiRenderer(rendererFactory);

            KolaConfigurationRegistry.RegisterRenderer(multiRenderer);

            this.result = instance.Render(multiRenderer);
        }
Esempio n. 2
0
        public void SetUp()
        {
            var atom1Specification = MockRepository.GenerateStub<IPluginComponentSpecification<IComponentWithProperties>>();
            var atom2Specification = MockRepository.GenerateStub<IPluginComponentSpecification<IComponentWithProperties>>();
            var atom3Specification = MockRepository.GenerateStub<IPluginComponentSpecification<IComponentWithProperties>>();
            var containerSpecification = MockRepository.GenerateStub<IPluginComponentSpecification<IComponentWithProperties>>();

            var renderingInstructions = MockRepository.GenerateStub<IRenderingInstructions>();

            atom1Specification.ViewName = "Atom1View";
            atom2Specification.ViewName = "Atom2View";
            atom3Specification.ViewName = "Atom3View";
            containerSpecification.ViewName = "Container1View";

            var handlerFactory = MockRepository.GenerateStub<IRendererFactory>();
            handlerFactory.Stub(h => h.GetAtomRenderer("atom1")).Return(new DefaultRenderer(atom1Specification));
            handlerFactory.Stub(h => h.GetAtomRenderer("atom2")).Return(new DefaultRenderer(atom2Specification));
            handlerFactory.Stub(h => h.GetAtomRenderer("atom3")).Return(new DefaultRenderer(atom3Specification));
            handlerFactory.Stub(h => h.GetContainerRenderer("container1")).Return(new DefaultRenderer(containerSpecification));

            var renderer = new MultiRenderer(handlerFactory);

            KolaConfigurationRegistry.RegisterRenderer(renderer);

            var page =
                new PageInstance(
                    new ComponentInstance[]
                        {
                            new AtomInstance(new[] { 0 }, renderingInstructions, "atom1", Enumerable.Empty<PropertyInstance>()),
                            new AtomInstance(new[] { 1 }, renderingInstructions, "atom2", Enumerable.Empty<PropertyInstance>()),
                            new ContainerInstance(new[] { 2 }, renderingInstructions, "container1", null, new[] { new AtomInstance(new[] { 2, 0 }, renderingInstructions, "atom3", Enumerable.Empty<PropertyInstance>()) })
                        }, renderingInstructions);

            var viewFactory = new TestViewFactory(renderer);
            var viewHelper = new TestViewHelper(viewFactory);

            var renderedPage = renderer.Render(page);
            this.result = renderedPage.ToHtml(viewHelper);
        }
Esempio n. 3
0
 public static void RegisterRenderer(MultiRenderer renderer)
 {
     Renderer = renderer;
 }
Esempio n. 4
0
 public TestViewFactory(MultiRenderer renderer)
 {
     this.renderer = renderer;
 }