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 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);
        }
Пример #3
0
        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 property = new Property(
                "property name",
                "property type",
                new VariablePropertyValue(
                    "language code",
                    new[]
                        {
                            new PropertyVariant("en", new FixedPropertyValue("English"), true),
                            new PropertyVariant(
                                "fr",
                                new VariablePropertyValue(
                                    "country code",
                                    new[]
                                        {
                                            new PropertyVariant("fr", new FixedPropertyValue("French French")),
                                            new PropertyVariant("ca", new FixedPropertyValue("French Canadian"))
                                        }))
                        }));

            var buildContext = new BuildData(new[] { new ContextItem("country code", "ca"), new ContextItem("language code", "fr") });

            this.propertyInstance = property.Build(buildContext);
        }
        public void SetUp()
        {
            var property = new Property("property name", "property type", new InheritedPropertyValue("key"));

            var contextItem = MockRepository.GenerateMock<IContextItem>();
            contextItem.Stub(c => c.Name).Return("key");
            contextItem.Stub(c => c.Value).Return("result");

            var context = new[] { contextItem };

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

            this.propertyInstance = property.Build(buildContext);
        }
        public void SetUp()
        {
            var property = new Property(
                "property name",
                "property type",
                new VariablePropertyValue(
                    "language code",
                    new[]
                        {
                            new PropertyVariant("en", new FixedPropertyValue("English"), true),
                            new PropertyVariant("fr", new FixedPropertyValue("Français"))
                        }));

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

            this.propertyInstance = property.Build(buildContext);
        }
        public void SetUp()
        {
            var property = new Property(
                "property name",
                "property type",
                new VariablePropertyValue(
                    "language code",
                    new[]
                        {
                            new PropertyVariant("en", new FixedPropertyValue("English"), true),
                            new PropertyVariant("fr", new InheritedPropertyValue("french message"))
                        }));

            var buildContext = new BuildData(new[] { new ContextItem("french message", "Bonjour!"), new ContextItem("language code", "fr") });

            this.propertyInstance = property.Build(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);
        }