Exemplo n.º 1
0
        private FieldList CopyFieldList(FieldList fields)
        {
            var copy = new FieldList();

            foreach (ID id in fields.GetFieldIDs())
            {
                copy.Add(id, fields[id]);
            }

            return(copy);
        }
Exemplo n.º 2
0
        public void CanCreateFields([ItemData(fields: true)] Item item)
        {
            FieldList innerFields = item.InnerData.Fields;

            innerFields.Count.Should().Be(3, "non virtual inner collection");
            item.Fields.Count.Should().Be(3, "virtual method value set by Factory");

            foreach (var id in innerFields.GetFieldIDs())
            {
                string value = innerFields[id];
                id.Should().NotBe(ID.Null, "field ID should be set");
                value.Should().NotBeNullOrEmpty("anonymous field value should be set");
                item[id].Should().Be(value, "item indexer set");
                item.Fields[id].Value.Should().Be(value, "Fields indexer set");
            }
            var firstId = innerFields.GetFieldIDs().First();
            var lastId  = innerFields.GetFieldIDs().Last();

            firstId.Should().NotBe(lastId, "IDs should differ");
            innerFields[firstId].Should().NotBe(innerFields[lastId], "values should differ");
        }