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); }
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); }