public void SetValue_UnitTest() { JsonBackedObjectBase instance = GetInstance(); JsonBackedDataBase source = new JsonBackedField <string>((Func <JToken, string>)null); const string target = "Target Value"; instance.SetValue(source, target); }
public void Eval_Null_UnitTest() { var instance = new JsonBackedField <String>(ReadFunc); const string expectedValue = default(String); string result = instance.Eval((JToken)null); Assert.IsNotNull(instance); Assert.AreEqual(expectedValue, result); }
public void TryGetValue_UnitTest() { JsonBackedObjectBase instance = GetInstance(); JsonBackedDataBase source = new JsonBackedField <string>((Func <JToken, string>)null); string target; bool result = instance.TryGetValue(source, out target); Assert.IsFalse(result); Assert.IsNull(target); }
public void Eval_UnitTest() { var instance = new JsonBackedField <String>(ReadFunc); const string expectedValue = TokenKey; var property = new JProperty(TokenKey, expectedValue); var json = new JObject { property }; string result = instance.Eval(json); Assert.IsNotNull(instance); Assert.AreEqual(expectedValue, 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); }
public void JsonBackedField_Constructor_ReadRwite_UnitTest() { var instance = new JsonBackedField <String>(ReadFunc, WriteAction); Assert.IsNotNull(instance); }
public void JsonBackedField_Constructor_ReadOnly_UnitTest() { var instance = new JsonBackedField <String>(ReadFunc); Assert.IsNotNull(instance); }
public void JsonBackedField_Constructor_Key_UnitTest() { var instance = new JsonBackedField <String>(TokenKey); Assert.IsNotNull(instance); }