Example #1
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);
        }
Example #2
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);
        }
Example #3
0
        public void UntypedCollection_Removed_InvalidObjectDoesNothing()
        {
            var objectToAdd = new SimpleField() { integerField = 10 };

            var collection = new UntypedCollection(collName);

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

            collection.Removed("2");

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