public void Eval_UnitTest()
        {
            JsonBackedDictionary <string>        instance = GetInstance();
            JsonBackedObjectBase                 source   = new TestJsonBackedObject(SourceJsonObject());
            IReadOnlyDictionary <string, string> result   = instance.Eval(source);

            Assert.IsNotNull(result);
        }
        public void SetValue_UnitTest()
        {
            JsonBackedDictionary <string> instance = GetInstance();
            JsonBackedObjectBase          source   = new TestJsonBackedObject(SourceJsonObject());
            const string fieldName = "TargetField";
            const string value     = "TargetValue";

            instance.SetValue(source, fieldName, value);
        }
Ejemplo n.º 3
0
        /// <summary>
        ///     Gets the instance.
        /// </summary>
        /// <returns>JsonBackedObjectBase.</returns>
        public static JsonBackedObjectBase GetInstance()
        {
            const string expectedValue = "TokenValue";
            var          property      = new JProperty("TokenKey", expectedValue);
            var          json          = new JObject {
                property
            };
            JsonBackedObjectBase instance = new TestJsonBackedObject(json);

            Assert.IsNotNull(instance);
            return(instance);
        }
        public void Eval_UnitTest1()
        {
            var instance = new JsonBackedList <string>(Func);

            Assert.IsNotNull(instance);
            const string expectedValue = "TokenValue";
            var          property      = new JProperty("TokenKey", expectedValue);
            var          json          = new JObject {
                property
            };
            JsonBackedObjectBase   source = new TestJsonBackedObject(json);
            IReadOnlyList <string> result = instance.Eval(source);

            Assert.IsNotNull(result);
        }
        public void Eval_JsonBackedObject_UnitTest()
        {
            var          instance      = new JsonBackedField <String>(ReadFunc);
            const string expectedValue = "TokenValue";
            var          property1     = new JProperty("TokenKey", "TokenValue");
            var          property2     = new JProperty("TargetField", "OriginalValue");
            var          json          = new JObject {
                property1, property2
            };
            var    source = new TestJsonBackedObject(json);
            string result = instance.Eval(source);

            Assert.IsNotNull(instance);
            Assert.AreEqual(expectedValue, result);

            // We read a second time to access the cached value...
            string result2 = instance.Eval(source);

            Assert.IsNotNull(instance);
            Assert.AreEqual(expectedValue, result2);
        }