コード例 #1
0
            public static SitecoreType <PrivateModelRecursive> Load()
            {
                var config = new SitecoreType <PrivateModelRecursive>();

                config.Field(x => x.Field1);
                return(config);
            }
コード例 #2
0
            public static SitecoreType <ProtectedModel> Load()
            {
                var config = new SitecoreType <ProtectedModel>();

                config.Field(x => x.Field1);
                config.Field(x => x.Field2);
                return(config);
            }
コード例 #3
0
        /// <summary>
        /// Imports another map from the configuration
        /// </summary>
        /// <typeparam name="TK"></typeparam>
        protected override void ImportMap <TK>()
        {
            SitecoreType <TK> typeConfig = GetSitecoreType <TK>();

            if (typeConfig == null)
            {
                return;
            }

            GlassType.Import(typeConfig);
        }
コード例 #4
0
        public void Import_ImportType_AddsPropertiesToNewType()
        {
            //Arrange
            var type1 = new SitecoreType<Stub1>();
            type1.Field(x => x.Field1);

            var type2 = new SitecoreType<Stub2>();
            type2.Field(x => x.Field2);

            //Act
            type2.Import(type1);

            //Assert
            Assert.AreEqual(2, type2.Config.Properties.Count());
            
        }
コード例 #5
0
        public void Import_ImportType_AddsPropertiesToNewType()
        {
            //Arrange
            var type1 = new SitecoreType <Stub1>();

            type1.Field(x => x.Field1);

            var type2 = new SitecoreType <Stub2>();

            type2.Field(x => x.Field2);

            //Act
            type2.Import(type1);

            //Assert
            Assert.AreEqual(2, type2.Config.Properties.Count());
        }
コード例 #6
0
        public void Import_ImportTypeFieldDefinedTwice_DoesNotThrowException()
        {
            //Arrange
            var type1 = new SitecoreType<Stub1>();
            type1.Field(x => x.Field1);

            var type2 = new SitecoreType<Stub2>();
            type2.Field(x => x.Field1);
            type2.Field(x => x.Field2);

            //Act
            type2.Import(type1);

            //Assert
            Assert.AreEqual(2, type2.Config.Properties.Count());

        }
コード例 #7
0
        public void Import_ImportTypeFieldDefinedTwice_DoesNotThrowException()
        {
            //Arrange
            var type1 = new SitecoreType <Stub1>();

            type1.Field(x => x.Field1);

            var type2 = new SitecoreType <Stub2>();

            type2.Field(x => x.Field1);
            type2.Field(x => x.Field2);

            //Act
            type2.Import(type1);

            //Assert
            Assert.AreEqual(2, type2.Config.Properties.Count());
        }