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);
        }
        public void SetUp()
        {
            var specification = new WidgetSpecification(
                "widget name",
                Enumerable.Empty<PropertySpecification>(),
                new IComponent[]
                    {
                        new Atom("atom", Enumerable.Empty<Property>()),
                        new Placeholder("area 1"),
                        new Container("container", Enumerable.Empty<Property>(), new[] { new Placeholder("area 2") })
                    });

            var widget = new Widget(
                "widget name",
                new[]
                    {
                        new Area("area 1", new IComponent[] { new Atom("atom", Enumerable.Empty<Property>()), new Atom("atom", Enumerable.Empty<Property>()) }),
                        new Area("area 2", new IComponent[] { new Atom("atom", Enumerable.Empty<Property>()), new Atom("atom", Enumerable.Empty<Property>()), new Atom("atom", Enumerable.Empty<Property>()) })
                    });

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

            var builder = new Builder(RenderingInstructions.BuildForPreview(), n => specification, null);

            this.instance = (WidgetInstance)widget.Build(builder, new[] { 0 }, buildContext);
        }
        public void SetUp()
        {
            var atom = new Atom(
                "atom",
                new[] { new Property("property-name", "property-type", new InheritedPropertyValue("property-alias")) });

            var containerSpecification = new ContainerSpecification("container");
            var container = containerSpecification.Create();
            container.Insert(0, atom);

            var widgetSpecification = new WidgetSpecification(
                "widget",
                new[] { new PropertySpecification("property-alias", "property-type", string.Empty) },
                new[] { container });

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

            var widget = widgetSpecification.Create();
            widget.FindOrCreateProperty(new PropertySpecification("property-alias", "property-type", string.Empty));
            widget.Properties.Single().Value = new FixedPropertyValue("property-value");

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

            this.instance = widget.Build(builder, new[] { 0 }, buildContext);
        }
        public void SetUp()
        {
            var atom = new Atom(
                "atom",
                new[] { new Property("property-name", "property-type", new InheritedPropertyValue("property-name")) });

            var parentSpecification = new ContainerSpecification("parent-container");

            var grandparentSpecification = new ContainerSpecification("grandparent-container");
            grandparentSpecification.AddProperty(new PropertySpecification("property-name", "property-type", string.Empty));

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

            var parent = parentSpecification.Create();
            parent.Insert(0, atom);

            var grandparent = grandparentSpecification.Create();
            grandparent.FindOrCreateProperty(new PropertySpecification("property-name", "property-type", string.Empty));
            grandparent.Properties.Single().Value = new FixedPropertyValue("property-value");
            grandparent.Insert(0, parent);

            var builder = new Builder(RenderingInstructions.BuildForPreview(), null, null);
            this.instance = grandparent.Build(builder, new[] { 0 }, buildContext);
        }
Exemple #5
0
        private PageInstance BuildPage(Template template, bool isPreview, IEnumerable<IContextItem> contextItems = null, string cacheControl = null)
        {
            if (isPreview)
            {
                template.ApplyAmendments(this.componentLibrary);
            }

            var renderingInstructions = isPreview
                ? RenderingInstructions.BuildForPreview()
                : RenderingInstructions.Build(cacheControl);

            var builder = new Builder(renderingInstructions, this.widgetSpecificationRepository.Find, this.componentLibrary);

            return builder.Build(template, new BuildData(contextItems));
        }