Пример #1
0
        public void UntypedCollection_Removed_RemovesObject()
        {
            var objectToAdd = new SimpleField() { integerField = 10 };

            var collection = new UntypedCollection(collName);

            collection.Added("1", JObject.FromObject(objectToAdd));

            collection.Removed("1");

            Assert.AreEqual(0, collection.Objects.Count);
        }
Пример #2
0
        public void UntypedCollection_Added_AddsValue()
        {
            var objectToAdd = new SimpleField() {integerField = 10};

            var collection = new UntypedCollection(collName);

            collection.Added("1", JObject.FromObject(objectToAdd));

            Assert.AreEqual(1, collection.Objects.Count);

            var objectAdded = collection.Objects["1"].ToObject<SimpleField>();

            Assert.AreEqual(10, objectAdded.integerField);
        }
Пример #3
0
        public void UntypedCollection_Changed_InvalidObjectDoesNothing()
        {
            var objectToAdd = new SimpleField() { integerField = 10 };

            var collection = new UntypedCollection(collName);

            collection.Added("1", JObject.FromObject(objectToAdd));

            var change = new Dictionary<string, JToken>()
            {
                {"integerField", JToken.FromObject(999)}
            };

            collection.Changed("2", change, null);

            var objectAdded = collection.Objects["1"].ToObject<SimpleField>();

            Assert.AreEqual(10, objectAdded.integerField);
        }
Пример #4
0
        public void UntypedCollection_Constructor_CollectionNameSet()
        {
            var collection = new UntypedCollection(collName);

            Assert.AreEqual(collName, collection.CollectionName);
        }