示例#1
0
 public void AddEachToSetTest()
 {
     DBModifier target = new DBModifier();
     ArrayList list = new ArrayList() {"a", "b", "c" };
     target.AddEachToSet("fieldName", list);
     target.GetAsIDBObject(DBModifier.ModifierOperation.AddToSet).GetAsIDBObject("fieldName")[DBModifier.ModifierOperation.Each].Should().Be(list);
 }
示例#2
0
 public void DBModifierConstructorTest2()
 {
     DBModifier target = new DBModifier();
 }
示例#3
0
 public void DBModifierConstructorTest1()
 {
     DBModifier target = new DBModifier(new Dictionary<string, object>() {{"a",1},{"b",2},{"c",3}});
     target.Keys.Count.Should().Be(3);
 }
示例#4
0
 public void DBModifierConstructorTest()
 {
     DBModifier target = new DBModifier("a", 1);
     target["a"].Should().Be(1);
 }
示例#5
0
 public void AddToSetTest()
 {
     DBModifier target = new DBModifier();
     target.AddToSet("fieldName", "a");
     target.GetAsIDBObject(DBModifier.ModifierOperation.AddToSet)["fieldName"].Should().Be("a");
 }
示例#6
0
 public void PushTest()
 {
     DBModifier target = new DBModifier();
     target.Push("fieldName", "a");
     target.GetAsIDBObject(DBModifier.ModifierOperation.Push)["fieldName"].Should().Be("a");
 }
示例#7
0
 public void PushAllTest()
 {
     DBModifier target = new DBModifier();
     ArrayList list = new ArrayList() { "a", "b", "c" };
     target.PushAll("fieldName", list);
     target.GetAsIDBObject(DBModifier.ModifierOperation.PushAll)["fieldName"].Should().Be(list);
 }
示例#8
0
        public void PopTest()
        {
            DBModifier target = new DBModifier();
            target.Pop("fieldName", false);
            target.GetAsIDBObject(DBModifier.ModifierOperation.Pop)["fieldName"].Should().Be(-1);

            target = new DBModifier();
            target.Pop("fieldName", true);
            target.GetAsIDBObject(DBModifier.ModifierOperation.Pop)["fieldName"].Should().Be(1);
        }
示例#9
0
 public void IncTest()
 {
     DBModifier target = new DBModifier();
     target.Inc("fieldName", 2);
     target.GetAsIDBObject(DBModifier.ModifierOperation.Inc)["fieldName"].Should().Be(2);
 }