public void SetUp()
        {
            var source1 = new TestSource
            {
                Name = "-artist-",
                GetAllItemsFunc = c => new[]
                {
                    new DynamicItem("beatles", new [] { new ContextItem("artist-id", "1") }),
                    new DynamicItem("beach-boys", new [] { new ContextItem("artist-id", "2") })
                }
            };

            var source2 = new TestSource
            {
                Name = "-album-",
                GetAllItemsFunc = c =>
                    {
                        return c.Any(i => i.Name == "artist-id" && i.Value == "1")
                        ? new[] { new DynamicItem("revolver") }
                        : new[] { new DynamicItem("pet-sounds") };
                    }
            };

            var dynamicSourceProvider = MockRepository.GenerateMock<IDynamicSourceProvider>();

            dynamicSourceProvider.Stub(p => p.Get("-artist-")).Return(source1);
            dynamicSourceProvider.Stub(p => p.Get("-album-")).Return(source2);
            var pathInstanceBuilder = new PathInstanceBuilder(dynamicSourceProvider);

            var template = new Template(new[] { "static", "-artist-", "-album-" });
            template.BuildInstancePaths(pathInstanceBuilder);

            this.resource = new TemplateResourceBuilder().Build(template) as TemplateResource;
        }
コード例 #2
0
        public void SetUp()
        {
            var dynamicSourceProvider = MockRepository.GenerateMock<IDynamicSourceProvider>();
            var pathInstanceBuilder = new PathInstanceBuilder(dynamicSourceProvider);

            var template = new Template(Enumerable.Empty<string>());
            template.BuildInstancePaths(pathInstanceBuilder);

            this.resource = new TemplateResourceBuilder().Build(template) as TemplateResource;
        }
コード例 #3
0
        public void SetUp()
        {
            var dynamicSourceProvider = MockRepository.GenerateMock<IDynamicSourceProvider>();
            var pathInstanceBuilder = new PathInstanceBuilder(dynamicSourceProvider);

            var template = new Template(new[] { "test", "path" }, new IComponent[]
                {
                    new Atom("atom 0", new[]
                        {
                            new Property("property 0", "property 0 type", new FixedPropertyValue("property 0 value")),
                            new Property("property 1", "property 1 type", new InheritedPropertyValue("property 1 key")),
                        }),
                    new Container("container 1", components: new[] { new Atom("atom 1.0") }),
                    new Widget("widget 2", areas: new[] { new Area("area 1", new[] { new Atom("atom 2.0.0") }), })
                });

            template.BuildInstancePaths(pathInstanceBuilder);

            this.resource = new TemplateResourceBuilder().Build(template) as TemplateResource;
        }