public void It_can_find_the_id_when_object_is_an_ExpandoObject() { var db = new MongoDatabaseProvider(new Configuration()); dynamic obj = new ExpandoObject(); obj.id = 42; ((object)db.GetId(obj)).ShouldEqual(42); }
public void It_throws_when_it_cant_find_a_suitable_ID() { var db = new MongoDatabaseProvider(new Configuration()); Assert.Throws<ArgumentException>(() => db.GetId(new {ObjectId = 42})); }
public void It_doesnt_convert_to_BsonObjectId_if_it_doesnt_parse() { var db = new MongoDatabaseProvider(new Configuration()); var id = Guid.NewGuid().ToString(); db.GetId(new {Id = id}).ShouldEqual(id); }
public void It_finds_the_id_named__id() { var db = new MongoDatabaseProvider(new Configuration()); db.GetId(new {_id = 42}).ShouldEqual(42); }
public void It_converts_strings_to_BsonObjectIds() { var db = new MongoDatabaseProvider(new Configuration()); var id = BsonObjectId.GenerateNewId(); db.GetId(new {Id = id.ToString()}).ShouldEqual(id); }