HasName() public method

public HasName ( string name ) : bool
name string
return bool
Esempio n. 1
0
        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"));
        }
Esempio n. 2
0
 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"));
 }
Esempio n. 3
0
 public void HasName()
 {
     DynamicObject dynobj = new DynamicObject();
     dynobj.SetValue("name", "Adam");
     Assert.IsTrue(dynobj.HasName("name"));
 }
Esempio n. 4
0
 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"));
 }
Esempio n. 5
0
 public void HasUndefinedName()
 {
     DynamicObject dynobj = new DynamicObject();
     Assert.IsFalse(dynobj.HasName("name"));
 }