コード例 #1
0
        public void Verify_does_not_allow_adding_any_null_fields_using_AddRange_via_IList()
        {
            var fields = new FieldList();

            var field1 = Field.Builder <Primitive>()
                         .Id("field1")
                         .DataType(SchemaDataType.Primitive)
                         .IsNullable()
                         .Build();

            fields.Add(field1);

            var field = Field.Builder <Primitive>()
                        .Id("field2")
                        .DataType(SchemaDataType.Primitive)
                        .IsNullable()
                        .Build();

            IList <PrimitiveField> fields2 = new List <PrimitiveField>();

            fields.Add(field);
            fields.Add(null);

            fields.AddRange(fields2);

            Assert.IsTrue(fields.HasValues);
            Assert.AreEqual(2, fields.Count);
        }
コード例 #2
0
        public TableKey(params string[] fieldNames)
        {
            Fields     = new FieldList();
            Properties = new TableKeyProperties(this);

            Fields.AddRange(fieldNames);
        }
コード例 #3
0
        public void Verify_does_not_allow_adding_duplicate_fields_using_AddRange()
        {
            var fields = new FieldList();

            var field1 = Field.Builder <Primitive>()
                         .Id("field1")
                         .DataType(SchemaDataType.Primitive)
                         .IsNullable()
                         .Build();

            fields.Add(field1);

            var field2 = Field.Builder <Primitive>()
                         .Id("field1")
                         .DataType(SchemaDataType.Primitive)
                         .IsNullable()
                         .Build();

            fields.AddRange(field2);

            Assert.IsTrue(fields.HasValues);
            Assert.AreEqual(2, fields.Count);
        }