public void Find_object_matching_a_Guid()
        {
            var db = MockRepository.GenerateMock<IObjectContainer>();
            var finder = new Db4oObjectFinder(db);

            var toReturn = new List<ITrip>
                               {
                                   new SimpleRangeTrip
                                       {
                                           ID = _guidToFind
                                       }
                               };
            db.Stub(x => x.Query(Arg<Predicate<ITrip>>.Is.NotNull))
                .Return(toReturn);

            var trip = finder.FetchObjectMatchingId<ITrip>(_guidToFind);

            Assert.That(trip, Is.Not.Null);
            Assert.That(trip.ID, Is.EqualTo(_guidToFind));
        }
示例#2
0
 public IDb4oObjectFinder CreateFinder()
 {
     var db = CreateObjectContainer();
     IDb4oObjectFinder finder = new Db4oObjectFinder(db);
     return finder;
 }