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); }
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); }
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); }
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"); }
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); }
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); }
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); }
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); }