public void ExecuteDeleteCommand() { DynamicObject dynobj = new DynamicObject(); dynobj.SetValue("name", "Adam"); dynobj.SetValue("age", 800); DeleteCommand cmd = new DeleteCommand(new DotExpression(new VariableExpression("adam"), "name")); var context = new Context(); context.SetValue("adam", dynobj); cmd.Execute(context); Assert.IsTrue(dynobj.HasName("age")); Assert.IsFalse(dynobj.HasName("name")); }
public void HasNameInPrototype() { Function function = new Function(null, null); DynamicObject dynobj = new DynamicObject(function); DynamicObject prototype = new DynamicObject(); function.SetValue("prototype", prototype); prototype.SetValue("name", "Adam"); Assert.IsTrue(dynobj.HasName("name")); }
public void HasName() { DynamicObject dynobj = new DynamicObject(); dynobj.SetValue("name", "Adam"); Assert.IsTrue(dynobj.HasName("name")); }
public void RemoveValue() { DynamicObject dynobj = new DynamicObject(); dynobj.SetValue("name", "Adam"); Assert.IsTrue(dynobj.HasName("name")); dynobj.RemoveValue("name"); Assert.IsFalse(dynobj.HasName("name")); Assert.AreSame(Undefined.Instance, dynobj.GetValue("name")); }
public void HasUndefinedName() { DynamicObject dynobj = new DynamicObject(); Assert.IsFalse(dynobj.HasName("name")); }