예제 #1
0
 public void can_create_new_bag_with_list()
 {
     dynamic lb = new ListBag();
     lb <<= new {Name = "John", Email="email"};
     Assert.That(lb.Name, Is.EqualTo("John"));
     Assert.That(lb.Email, Is.EqualTo("email"));
 }
예제 #2
0
 public override bool TryBinaryOperation(BinaryOperationBinder binder, object arg, out object result)
 {
     if(binder.Operation == ExpressionType.LeftShiftAssign)
     {
         var copy = new ListBag(_dict, _list);
         copy.AddMembersFromObject(arg);
         result = copy;
         return true;
     }
     result = null;
     return false;
 }
예제 #3
0
 public void can_get_by_index()
 {
     dynamic lb = new ListBag();
     lb.Name = "John";
     Assert.That(lb[0], Is.EqualTo("John"));
 }
예제 #4
0
 public void can_get_and_set_by_name()
 {
     dynamic lb = new ListBag();
     lb.Name = "John";
     Assert.AreEqual(lb.Name,"John");
 }