public void UnknownRepeater() { ApplicationData target = new ApplicationData(); Dictionary<string, object>[] repeater = new Dictionary<string, object>[2]; repeater[0] = new Dictionary<string, object>(); repeater[1] = new Dictionary<string, object>(); target["repeater1"] = repeater; repeater[0]["field1"] = "leave me alone!"; repeater[0]["field2"] = "leave me alone too!"; repeater[1]["field1"] = "leave me alone!"; repeater[1]["field2"] = "i'm incorrect anyway - update me!"; ApplicationData source = new ApplicationData(); Dictionary<string, object>[] sourceRepeater = new Dictionary<string, object>[2]; sourceRepeater[0] = new Dictionary<string, object>(); sourceRepeater[1] = new Dictionary<string, object>(); source["repeater1"] = sourceRepeater; sourceRepeater[1]["field2"] = "you've been overwritten!"; sourceRepeater[1]["field3"] = "I am the unknown control!"; target.UpdateFrom(source); Assert.IsNull(target.GetValue<string>("repeater1[1].field3")); }
public void Unknown() { ApplicationData target = new ApplicationData(); target["field1"] = "leave me alone!"; ApplicationData source = new ApplicationData(); source["field2"] = "you've been overwritten!"; source["field3"] = "I am the unknown control!"; target.UpdateFrom(source); Assert.IsFalse(target.ContainsKey("field3")); }
public void Retain() { ApplicationData target = new ApplicationData(); target["field1"] = "leave me alone!"; ApplicationData source = new ApplicationData(); source["field2"] = "you've been overwritten!"; target.UpdateFrom(source); Assert.AreEqual("leave me alone!", target["field1"]); }
public void RetainRepeater() { ApplicationData target = new ApplicationData(); Dictionary<string, object>[] repeater = new Dictionary<string, object>[2]; repeater[0] = new Dictionary<string, object>(); repeater[1] = new Dictionary<string, object>(); target["repeater1"] = repeater; repeater[0]["field1"] = "leave me alone!"; repeater[0]["field2"] = "leave me alone too!"; repeater[1]["field1"] = "leave me alone!"; repeater[1]["field2"] = "i'm incorrect anyway - update me!"; ApplicationData source = new ApplicationData(); Dictionary<string, object>[] sourceRepeater = new Dictionary<string, object>[2]; sourceRepeater[0] = new Dictionary<string, object>(); sourceRepeater[1] = new Dictionary<string, object>(); source["repeater1"] = sourceRepeater; sourceRepeater[1]["field2"] = "you've been overwritten!"; target.UpdateFrom(source); Assert.AreEqual("leave me alone too!", target.GetValue<string>("repeater1[0].field2")); }
public void Overwrite() { ApplicationData target = new ApplicationData(); target["field1"] = "leave me alone!"; target["field2"] = "i'm incorrect anyway - update me!"; ApplicationData source = new ApplicationData(); source["field2"] = "you've been overwritten!"; target.UpdateFrom(source); Assert.AreEqual("you've been overwritten!", target["field2"]); }