Пример #1
0
        public void ParseEmptyAttributesTest()
        {
            ItemTypeAttributes attrs = ItemTypeAttributes.Parse(Parse("<attributes/>"));

            List <AttributeId> attributeIds = attrs.Attributes;

            Assert.IsNotNull(attributeIds);
            Assert.AreEqual(0, attributeIds.Count);
        }
Пример #2
0
        public void ParseAttributesTest()
        {
            ItemTypeAttributes attrs = ItemTypeAttributes.Parse(Parse("<attributes>" +
                                                                      "<attribute name='a' type='text'/>" +
                                                                      "<attribute name='b' type='boolean'/>" +
                                                                      "</attributes>"));
            List <AttributeId> attributeIds = attrs.Attributes;

            Assert.AreEqual(2, attributeIds.Count);
            Assert.AreEqual("a", attributeIds[0].Name);
            Assert.AreEqual(GBaseAttributeType.Text, attributeIds[0].Type);
            Assert.AreEqual("b", attributeIds[1].Name);
            Assert.AreEqual(GBaseAttributeType.Boolean, attributeIds[1].Type);
        }
Пример #3
0
        public void GenerateAttributesTest()
        {
            AttributeId[] ids = { new AttributeId("x", GBaseAttributeType.Int),
                                  new AttributeId("y", GBaseAttributeType.Float) };
            string        xml = GenerateXml(new ItemTypeAttributes(new List <AttributeId>(ids)));

            List <AttributeId> parsedIds =
                ItemTypeAttributes.Parse(Parse(xml)).Attributes;

            Assert.AreEqual(2, parsedIds.Count);
            Assert.AreEqual("x", parsedIds[0].Name);
            Assert.AreEqual(GBaseAttributeType.Int, parsedIds[0].Type);
            Assert.AreEqual("y", parsedIds[1].Name);
            Assert.AreEqual(GBaseAttributeType.Float, parsedIds[1].Type);
        }