public void NetObject_Get_Property_Point() { var point = new Point(10, 5); var netObj = new NetObject(point); var x = netObj.Get("X"); var y = netObj.Get("Y"); Assert.AreEqual(10, x.ToObject()); Assert.AreEqual(5, y.ToObject()); }
private IValue AtKey(List <IValue> arguments, Scope s) { ListNode list = (ListNode)arguments[0]; NetObject netObj = (NetObject)list.Children[1].Eval(s); IdentifierNode index = (IdentifierNode)list.Children[2]; return(netObj.Get(index.Name)); }
public void NetObject_Get_Property() { DateTime now = DateTime.Now; var netObj = new NetObject(now); var date = netObj.Get("Date"); Assert.AreEqual(now.Date, date.ToObject()); }
public void NetObject_Set_Property() { var point = new Point(10, 5); var netObj = new NetObject(point); netObj.Set("X", new NetObject(-10)); var x = netObj.Get("X"); Assert.AreEqual(-10, x.ToObject()); }
public void NetObject_Get_Field() { string expected = "some string"; var ok = new FieldClass { Ok = expected }; var netObj = new NetObject(ok); var actual = netObj.Get("Ok"); Assert.AreEqual(expected, actual.ToObject()); }
public void NetObject_Set_Field() { string expected = "new string"; var ok = new FieldClass { Ok = "old string" }; var netObj = new NetObject(ok); netObj.Set("Ok", new NetObject(expected)); var actual = netObj.Get("Ok"); Assert.AreEqual(expected, actual.ToObject()); }