コード例 #1
0
        public void Setup()
        {
            Context context = new Context(
                new AttributeConfigurationLoader(
                    "Glass.Sitecore.Mapper.Tests.Data.SitecoreChildrenHandlerFixture,  Glass.Sitecore.Mapper.Tests",
                    "Glass.Sitecore.Mapper.Tests.Domain,  Glass.Sitecore.Mapper.Tests"));

            _db = global::Sitecore.Configuration.Factory.GetDatabase("master");

            _service = new SitecoreService(_db);
            _itemPath = "/sitecore/content/Data/SitecoreChildrenHandler/Root";

            _handler = new SitecoreChildrenHandler();
        }
        public void Setup()
        {
            var context = new InstanceContext(
              (new SitecoreClassConfig[]{
                   new SitecoreClassConfig(){
                       ClassAttribute = new SitecoreClassAttribute(),
                       Properties = new SitecoreProperty[]{},
                       Type = typeof(SitecoreChildrenHandlerFixtureNS.SubClass),
                       DataHandlers = new AbstractSitecoreDataHandler []{}
                   },
                   new SitecoreClassConfig(){
                       ClassAttribute = new SitecoreClassAttribute(),
                       Properties = new SitecoreProperty[]{
                            new SitecoreProperty(){
                                Attribute = new SitecoreIdAttribute(),
                                Property = typeof(SitecoreChildrenHandlerFixtureNS.BaseType).GetProperty("Id")
                            }
                       },
                       Type = typeof(SitecoreChildrenHandlerFixtureNS.BaseType),
                       DataHandlers = new AbstractSitecoreDataHandler []{
                        new SitecoreIdDataHandler(){
                               Property = typeof(SitecoreChildrenHandlerFixtureNS.BaseType).GetProperty("Id")
                        }
                       }
                   },
                   new SitecoreClassConfig(){
                       ClassAttribute = new SitecoreClassAttribute(){
                           
                       },
                       Properties = new SitecoreProperty[]{
                            new SitecoreProperty(){
                                Attribute = new SitecoreIdAttribute(),
                                Property = typeof(SitecoreChildrenHandlerFixtureNS.TypeOne).GetProperty("Id")
                            }
                       },
                       Type = typeof(SitecoreChildrenHandlerFixtureNS.TypeOne),
                       DataHandlers = new AbstractSitecoreDataHandler []{
                        new SitecoreIdDataHandler(){
                               Property = typeof(SitecoreChildrenHandlerFixtureNS.TypeOne).GetProperty("Id")
                        }
                       },
                       TemplateId = new Guid("{5B684B69-F532-4BB2-8A98-02AFCDE4BB84}")
                   },
                   new SitecoreClassConfig(){
                       ClassAttribute = new SitecoreClassAttribute(){
                          
                       },
                       Properties = new SitecoreProperty[]{
                            new SitecoreProperty(){
                                Attribute = new SitecoreIdAttribute(),
                                Property = typeof(SitecoreChildrenHandlerFixtureNS.TypeTwo).GetProperty("Id")
                            }
                       },
                       Type = typeof(SitecoreChildrenHandlerFixtureNS.TypeTwo),
                       DataHandlers = new AbstractSitecoreDataHandler []{
                        new SitecoreIdDataHandler(){
                               Property = typeof(SitecoreChildrenHandlerFixtureNS.TypeTwo).GetProperty("Id")
                        }
                       },
                       TemplateId = new Guid("{3902F503-7DC7-48B2-9FD8-1EB878CEBA93}")
                   }

               }).ToDictionary(), new AbstractSitecoreDataHandler[] { });



            _db = global::Sitecore.Configuration.Factory.GetDatabase("master");

            _service = new SitecoreService(_db, context);

            _itemId = new Guid("{D22C2A23-DF8A-4EC1-AD52-AE15FE63F937}");
            _handler = new SitecoreChildrenHandler();
        }