예제 #1
0
 public void RemoveTest3()
 {
     DBObject a = new DBObject();
     DBObject b = new DBObject("a", 7);
     DBObject c = new DBObject("78", "car");
     IList target = new DBObjectArray(a, b, c) as IList;
     target.Remove(b);
     target.IndexOf(c).Should().Be(1);
     target.Count.Should().Be(2);
 }
예제 #2
0
 public void RemoveTest1()
 {
     DBObject a = new DBObject();
     DBObject b = new DBObject("a", 7);
     DBObject c = new DBObject("78", "car");
     DBObjectArray target = new DBObjectArray(a, b, c);
     target.IndexOf(a).Should().Be(0);
     target.IndexOf(b).Should().Be(1);
     target.IndexOf(c).Should().Be(2);
     target.Count.Should().Be(3);
     target.Remove("1");
     target.IndexOf(a).Should().Be(0);
     target.IndexOf(c).Should().Be(1);
     target.Count.Should().Be(2);
 }
예제 #3
0
 public void RemoveTest2()
 {
     DBObject a = new DBObject();
     DBObject b = new DBObject("a", 7);
     DBObject c = new DBObject("78", "car");
     DBObjectArray target = new DBObjectArray(a, b, c);
     target.IndexOf(a).Should().Be(0);
     target.IndexOf(b).Should().Be(1);
     target.IndexOf(c).Should().Be(2);
     target.Count.Should().Be(3);
     target.Remove(new KeyValuePair<string, object>("1",b));
     target.IndexOf(a).Should().Be(0);
     target.IndexOf(c).Should().Be(1);
     target.Count.Should().Be(2);
 }
예제 #4
0
        public void PutAllTest()
        {
            DBObject a = new DBObject();
            DBObject b = new DBObject("a", 7);
            DBObject c = new DBObject("78", "car");
            DBObjectArray target = new DBObjectArray();
            IDictionary<string, object> map = new Dictionary<string, object>() { { "0", a }, { "1", b }, { "2", c } };
            target.PutAll(map);
            target.IndexOf(a).Should().Be(0);
            target.IndexOf(b).Should().Be(1);
            target.IndexOf(c).Should().Be(2);
            target.Count.Should().Be(3);

            new Action(() => target.PutAll(new Dictionary<string, object>() { { "a", a } })).ShouldThrow<Exception>("index/key must be an integer");
        }
예제 #5
0
 public void InsertTest1()
 {
     DBObject a = new DBObject();
     DBObject b = new DBObject("a", 7);
     DBObject c = new DBObject("78", "car");
     IList target = new DBObjectArray(a, c) as IList;
     target.Insert(1, b);
     target.IndexOf(b).Should().Be(1);
 }
예제 #6
0
 public void InsertTest()
 {
     DBObject a = new DBObject();
     DBObject b = new DBObject("a", 7);
     DBObject c = new DBObject("78", "car");
     DBObjectArray target = new DBObjectArray(a, c);
     target.IndexOf(a).Should().Be(0);
     target.IndexOf(c).Should().Be(1);
     target.Insert(1, b);
     target.IndexOf(a).Should().Be(0);
     target.IndexOf(b).Should().Be(1);
     target.IndexOf(c).Should().Be(2);
     target.Count.Should().Be(3);
 }
예제 #7
0
 public void DBObjectArrayConstructorTest5()
 {
     DBObject a = new DBObject();
     DBObject b = new DBObject("a", 7);
     DBObject c = new DBObject("78", "car");
     DBObjectArray target = new DBObjectArray(a, b, c);
     target.IndexOf(a).Should().Be(0);
     target.IndexOf(b).Should().Be(1);
     target.IndexOf(c).Should().Be(2);
     target.Count.Should().Be(3);
 }
예제 #8
0
 public void DBObjectArrayConstructorTest2()
 {
     DBObject a = new DBObject();
     DBObject b = new DBObject("a", 7);
     DBObject c = new DBObject("78", "car");
     DBObjectArray target = new DBObjectArray(new Dictionary<string,object>() {{"0", a},{"1", b},{"2", c}});
     target.IndexOf(a).Should().Be(0);
     target.IndexOf(b).Should().Be(1);
     target.IndexOf(c).Should().Be(2);
     target.Count.Should().Be(3);
 }