public void should_return_all_objects()
        {
            ctx = GetContext();

            var foundGuids = ctx.FindPersistenceObjects<ObjectClass>(guids).ToList().Select(cls => cls.ExportGuid);
            Assert.That(foundGuids, Is.EquivalentTo(guids));
        }
        public void should_not_return_nulls()
        {
            var lookupGuids = guids.Concat(new[] { Guid.Empty }); // add illegal value

            ctx = GetContext();

            var foundObjs = ctx.FindPersistenceObjects<ObjectClass>(lookupGuids).ToList();
            Assert.That(foundObjs, Has.No.Member(null), "FindPersistenceObjects returned a null entry");

            var foundGuids = foundObjs.Select(cls => cls.ExportGuid);
            Assert.That(foundGuids, Is.EquivalentTo(guids));
        }
Example #3
0
        private static void PreFetchObjects(IZetboxContext ctx, Dictionary <Guid, IPersistenceObject> objects, Dictionary <Type, List <Guid> > guids)
        {
            Log.Info("Prefetching Objects");
            foreach (Type t in guids.Keys)
            {
                IEnumerable <IPersistenceObject> result = ctx.FindPersistenceObjects(ctx.GetInterfaceType(t), guids[t]);
                if (Log.IsDebugEnabled)
                {
                    // avoid result.Count() evaluation if not needed
                    Log.DebugFormat("{0}: XML: {1}, Storage: {2}", t.FullName, guids[t].Count, result.Count());
                }

                foreach (IPersistenceObject obj in result)
                {
                    objects.Add(((IExportableInternal)obj).ExportGuid, obj);
                }
            }
        }
Example #4
0
        private static void PreFetchObjects(IZetboxContext ctx, Dictionary<Guid, IPersistenceObject> objects, Dictionary<Type, List<Guid>> guids)
        {
            Log.Info("Prefetching Objects");
            foreach (Type t in guids.Keys)
            {
                IEnumerable<IPersistenceObject> result = ctx.FindPersistenceObjects(ctx.GetInterfaceType(t), guids[t]);
                if (Log.IsDebugEnabled)
                {
                    // avoid result.Count() evaluation if not needed
                    Log.DebugFormat("{0}: XML: {1}, Storage: {2}", t.FullName, guids[t].Count, result.Count());
                }

                foreach (IPersistenceObject obj in result)
                {
                    objects.Add(((IExportableInternal)obj).ExportGuid, obj);
                }
            }
        }