public bool HasName(string name)
{
if (this.values.ContainsKey(name))
return true;
if (this.function == null)
return false;
object prototype = this.function.GetValue("prototype");
if (prototype == null || prototype == Undefined.Instance)
return false;
return ((IObject)prototype).HasName(name);
}
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")); }