HasName() public method

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