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")); }
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; }
public void can_get_by_index() { dynamic lb = new ListBag(); lb.Name = "John"; Assert.That(lb[0], Is.EqualTo("John")); }
public void can_get_and_set_by_name() { dynamic lb = new ListBag(); lb.Name = "John"; Assert.AreEqual(lb.Name,"John"); }