Esempio n. 1
0
        public Article()
        {
            // Basic setup
            this.Setup();

            // Get the DocType for this Content
            EntityType = new ArticleDocType();

            this.AsDynamic().textdata = "New text data";
        }
        public void ArticleDocTypeTest_One_Property_On_DocType()
        {
            //Arrange
            var dt = new ArticleDocType();
            //Act

            //Assert
            var properties = from tab in dt.AttributeSchema.AttributeGroupDefinitions
                             from p in tab.AttributeDefinitions
                             select p;

            Assert.AreEqual(1, properties.Count());
        }
Esempio n. 3
0
        public NewsDocType()
        {
            // Define a name and an alias for the doctype
            // Setup<TAllowedType> is an extension method declared on EntityFactory
            this.Setup("news", "News");

            // Create a new tab group
            var newsGroup = EntityFactory.Create <AttributeGroupDefinition>("newsdata", "News Data");

            base.AttributeSchema.AttributeGroupDefinitions.Add(newsGroup);


            // Create a serialization type for persisting this to the repository
            var stringSerializer = EntityFactory.Create <StringSerializationType>("string", "String");

            stringSerializer.DataSerializationType = DataSerializationTypes.String;

            // Create a data type
            var textInputField = EntityFactory.Create <AttributeTypeDefinition>("textInputField", "Text Input Field");

            // Create a new property with that data type in our tab group
            var bodyText = EntityFactory.CreateAttributeIn <AttributeDefinition>("bodyText", "Body Text", textInputField,
                                                                                 stringSerializer, newsGroup);


            // Create a data type
            var pictureInputField = EntityFactory.Create <AttributeTypeDefinition>("pictureInputField",
                                                                                   "Picture Input Field");

            // Create a new property with that data type in our tab group
            var image = EntityFactory.CreateAttributeIn <AttributeDefinition>("image", "Image", pictureInputField,
                                                                              stringSerializer, newsGroup);


            // Specify that only an Article can be a child of a News item
            var articleDocType = new ArticleDocType();

            base.GraphSchema.PermittedDescendentTypes.Add(articleDocType);
        }
Esempio n. 4
0
        public NewsDocType()
        {
            // Define a name and an alias for the doctype
            // Setup<TAllowedType> is an extension method declared on EntityFactory
            this.Setup("news", "News");

            // Create a new tab group
            var newsGroup = EntityFactory.Create<AttributeGroupDefinition>("newsdata", "News Data");
            base.AttributeSchema.AttributeGroupDefinitions.Add(newsGroup);


            // Create a serialization type for persisting this to the repository
            var stringSerializer = EntityFactory.Create<StringSerializationType>("string", "String");
            stringSerializer.DataSerializationType = DataSerializationTypes.String;

            // Create a data type
            var textInputField = EntityFactory.Create<AttributeTypeDefinition>("textInputField", "Text Input Field");

            // Create a new property with that data type in our tab group
            var bodyText = EntityFactory.CreateAttributeIn<AttributeDefinition>("bodyText", "Body Text", textInputField,
                                                                                stringSerializer, newsGroup);


            // Create a data type
            var pictureInputField = EntityFactory.Create<AttributeTypeDefinition>("pictureInputField",
                                                                                  "Picture Input Field");

            // Create a new property with that data type in our tab group
            var image = EntityFactory.CreateAttributeIn<AttributeDefinition>("image", "Image", pictureInputField,
                                                                             stringSerializer, newsGroup);


            // Specify that only an Article can be a child of a News item
            var articleDocType = new ArticleDocType();
            base.GraphSchema.PermittedDescendentTypes.Add(articleDocType);
        }
        public void ArticleDocTypeTest_ArticleDocType_Is_Allowed_Child()
        {
            //Arrange
            var dt = new ArticleDocType();
            //Act

            //Assert
            Assert.IsTrue(dt.GraphSchema.PermittedDescendentTypes.IsRegistered<IEntityTypeDefinition, ArticleDocType>());
            Assert.IsTrue(dt.GraphSchema.PermittedDescendentTypes.IsRegistered(typeof(ArticleDocType)));
            //TODO: You can do this with Contains and the ID of the docType but that doesn't seem right, you should be able to do it off types IMO
        }
        public void ArticleDocTypeTest_One_Tab_On_DocType()
        {
            //Arrange
            var dt = new ArticleDocType();
            //Act

            //Assert
            Assert.AreEqual(1, dt.AttributeSchema.AttributeGroupDefinitions.Count);
        }