public void Add_String_Test() { var j = WFJson.Parse("[]"); j.Add("a"); Assert.AreEqual(j.ToString(), "[\"a\"]"); }
public void Contains_Int_Test() { var j = WFJson.Parse("[1,2,3]"); Assert.IsTrue(j.Contains(1)); Assert.IsFalse(j.Contains(5)); }
public void Add_Object_Test() { var j = WFJson.Parse("[]"); j.Add(obj); Assert.AreEqual(j.ToString(), "[" + new WFJson(obj) + "]"); }
public void Add_Bool_Test() { var j = WFJson.Parse("[]"); j.Add(true); Assert.AreEqual(j.ToString(), "[true]"); }
public void Add_Int_Test() { var j = WFJson.Parse("[]"); j.Add(1); Assert.AreEqual(j.ToString(), "[1]"); }
public void Indexer_String_Get_Test() { var b = Newtonsoft.Json.JsonConvert.SerializeObject(obj); var j = WFJson.Parse(b); Assert.AreEqual <int>(j["a"].V <int>(), 123); }
public void V_Path_Test() { var b = Newtonsoft.Json.JsonConvert.SerializeObject(obj); var j = WFJson.Parse(b); Assert.AreEqual <int>(j.V <int>("b[1].b1"), 3); }
public void Parse_Test() { var b = Newtonsoft.Json.JsonConvert.SerializeObject(obj); var j = WFJson.Parse(b); Assert.IsInstanceOfType(j, typeof(WFJson)); }
public void StandardTest() { var rtv = InvokeWF("standard", new { a = 2, b = 3 }); var j = WFJson.Parse(rtv); //c=(a+b)*100 Assert.AreEqual(j.V <int>("c"), 500); }
public void IndexOf_Int_Test() { var j = WFJson.Parse("[]"); Assert.AreEqual(j.IndexOf(1), -1); j.Add(1); Assert.AreEqual(j.IndexOf(1), 0); }
public void Add_WFJson_Test() { var j = WFJson.Parse("[]"); var a = new WFJson("sd"); j.Add(a); Assert.AreEqual(j[0].ToString(), a.ToString()); }
public void Add_DateTime_Test() { var j = WFJson.Parse("[]"); DateTime dt = DateTime.Now; j.Add(dt); Assert.AreEqual(j[0].V <DateTime>(), dt); }
public void IndexOf_WFJson_Test() { var j = WFJson.Parse("[]"); var a = new WFJson(1); Assert.AreEqual <int>(j.IndexOf(a), -1); j.Add(a); Assert.AreEqual <int>(j.IndexOf(a), 0); }
public void Contains_WFJson_Test() { var j = WFJson.Parse("[]"); var a = new WFJson(1); Assert.IsFalse(j.Contains(a)); j.Add(a); Assert.IsTrue(j.Contains(a)); }
public void Indexer_String_Get_Object_Test() { MyClass my = new MyClass() { Name = "Name", Age = 23 }; var j = WFJson.Parse("{a:null}"); j["a"] = new WFJson(my); var rtv = j["a"].V <MyClass>(); Assert.IsInstanceOfType(rtv, typeof(MyClass)); Assert.AreEqual(rtv.Name, my.Name); Assert.AreEqual(rtv.Age, my.Age); }