public void It_can_find_a_normal_document_by_id() { var collection = TestUtils.GetCollection<Car>("cars"); var car = new Car {Make = "Suburu", Model = "Impreza"}; collection.Save(car); var db = new MongoDatabaseProvider(new Configuration()); var fromDb = db.GetById<Car>("cars", car.Id); fromDb.ShouldNotBeNull(); fromDb.Make.ShouldEqual("Suburu"); fromDb.Model.ShouldEqual("Impreza"); }
public IEnumerable<SetupObject> Setup() { var car = new Car {Make = "Chevy", Model = "Cruze"}; yield return new SetupObject("cars", car);; yield return new SetupObject("drivers", new Driver{Name = "Tim Kellogg", CarId = car.Id}); }
public void Objects_added_explicitly_will_get_cleaned_up_at_the_end_with_the_rest() { var collection = TestUtils.GetCollection<Car>("cars"); var originalNumberOfCars = collection.FindAll().Count(); using (var session = FixtureSession.Create()) { var fusion = new Car {Make = "Ford", Model = "Fusion"}; collection.Save(fusion); session.Track(fusion, "cars"); collection.FindAll().Count().ShouldEqual(originalNumberOfCars + 1); } collection.FindAll().Count().ShouldEqual(originalNumberOfCars); }