Example #1
0
        public void Run(TestConfig config)
        {
            int count = config.Count;
            var res   = new TestResult();

            config.Result = res;

            IDatabase db = config.GetDatabase();

            Tests.Assert(db.Root == null);
            Root root = new Root();

            Tests.AssertDatabaseException(() =>
                                          { root.idxBool = db.CreateFieldIndex <bool, RecordFullWithProperty>("NonExistent", IndexType.NonUnique); },
                                          DatabaseException.ErrorCode.INDEXED_FIELD_NOT_FOUND);

            // test that we don't allow mismatched index type and type of indexed field
            Tests.AssertDatabaseException(() =>
                                          { root.idxBool = db.CreateFieldIndex <bool, RecordFullWithProperty>("CharVal", IndexType.NonUnique); },
                                          DatabaseException.ErrorCode.INCOMPATIBLE_KEY_TYPE);

            root.idxBool     = db.CreateFieldIndex <bool, RecordFullWithProperty>("BoolVal", IndexType.NonUnique);
            root.idxByte     = db.CreateFieldIndex <byte, RecordFullWithProperty>("ByteVal", IndexType.NonUnique);
            root.idxSByte    = db.CreateFieldIndex <sbyte, RecordFullWithProperty>("SByteVal", IndexType.NonUnique);
            root.idxShort    = db.CreateFieldIndex <short, RecordFullWithProperty>("Int16Val", IndexType.NonUnique);
            root.idxUShort   = db.CreateFieldIndex <ushort, RecordFullWithProperty>("UInt16Val", IndexType.NonUnique);
            root.idxInt      = db.CreateFieldIndex <int, RecordFullWithProperty>("Int32Val", IndexType.NonUnique);
            root.idxUInt     = db.CreateFieldIndex <uint, RecordFullWithProperty>("UInt32Val", IndexType.NonUnique);
            root.idxLong     = db.CreateFieldIndex <long, RecordFullWithProperty>("Int64Val", IndexType.Unique);
            root.idxLongProp = db.CreateFieldIndex <long, RecordFullWithProperty>("Int64Prop", IndexType.Unique);
            root.idxULong    = db.CreateFieldIndex <ulong, RecordFullWithProperty>("UInt64Val", IndexType.NonUnique);
            root.idxChar     = db.CreateFieldIndex <char, RecordFullWithProperty>("CharVal", IndexType.NonUnique);
            root.idxFloat    = db.CreateFieldIndex <float, RecordFullWithProperty>("FloatVal", IndexType.NonUnique);
            root.idxDouble   = db.CreateFieldIndex <double, RecordFullWithProperty>("DoubleVal", IndexType.NonUnique);
            root.idxDate     = db.CreateFieldIndex <DateTime, RecordFullWithProperty>("DateTimeVal", IndexType.NonUnique);
            root.idxDecimal  = db.CreateFieldIndex <Decimal, RecordFullWithProperty>("DecimalVal", IndexType.NonUnique);
            root.idxGuid     = db.CreateFieldIndex <Guid, RecordFullWithProperty>("GuidVal", IndexType.NonUnique);
            root.idxString   = db.CreateFieldIndex <String, RecordFullWithProperty>("StrVal", IndexType.NonUnique);
            //root.idxEnum = db.CreateFieldIndex<RecordFullWithPropertyEnum, RecordFullWithProperty>("EnumVal", IndexType.NonUnique);
            //root.idxObject = db.CreateFieldIndex<object, RecordFullWithProperty>("ObjectVal", IndexType.NonUnique);

            root.idxIntAuto  = db.CreateFieldIndex <int, RecordAuto>("IntAuto", IndexType.Unique);
            root.idxLongAuto = db.CreateFieldIndex <long, RecordAuto>("LongAuto", IndexType.Unique);
            db.Root          = root;

            Tests.Assert(root.idxString.IndexedClass == typeof(RecordFullWithProperty));
            Tests.Assert(root.idxString.KeyField.Name == "StrVal");

            int i = 0;
            RecordFullWithProperty rfFirst = null;
            RecordAuto             raFirst = null;
            long firstKey = 0;

            foreach (long key in Tests.KeySeq(count))
            {
                var r = new RecordFullWithProperty(key);
                root.idxBool.Put(r);
                root.idxByte.Put(r);
                root.idxSByte.Put(r);
                root.idxShort.Put(r);
                root.idxUShort.Put(r);
                root.idxInt.Put(r);
                root.idxUInt.Put(r);
                root.idxLong.Put(r);
                root.idxLongProp.Put(r);
                root.idxULong.Put(r);
                root.idxChar.Put(r);
                root.idxFloat.Put(r);
                root.idxDouble.Put(r);
                root.idxDate.Put(r);
                root.idxDecimal.Put(r);
                root.idxGuid.Put(r);
                root.idxString.Put(r);
                //root.idxEnum.Put(r);
                //root.idxObject.Put(r);

                var ra = new RecordAuto();
                root.idxIntAuto.Append(ra);
                root.idxLongAuto.Append(ra);
                Tests.Assert(ra.IntAuto == i);
                Tests.Assert(ra.LongAuto == i);
                i++;
                if (null == rfFirst)
                {
                    rfFirst  = r;
                    raFirst  = ra;
                    firstKey = key;
                }
            }
            db.Commit();
            var rFullNew = new RecordFullWithProperty(firstKey);
            var rAutoNew = new RecordAuto();

            // Contains for unique index
            Tests.Assert(root.idxLong.Contains(rfFirst));
            Tests.Assert(!root.idxLong.Contains(rFullNew));

            Tests.Assert(root.idxLongAuto.Contains(raFirst));
            Tests.Assert(!root.idxLongAuto.Contains(rAutoNew));

            // Contains() for non-unique index
            Tests.Assert(root.idxInt.Contains(rfFirst));
            Tests.Assert(!root.idxInt.Contains(rFullNew));

            Tests.Assert(root.idxIntAuto.Contains(raFirst));
            Tests.Assert(!root.idxIntAuto.Contains(rAutoNew));

            Tests.Assert(false == root.idxLongProp.Put(rFullNew));
            root.idxLongProp.Set(rFullNew);

            Tests.AssertDatabaseException(() =>
                                          { root.idxString.Append(rfFirst); },
                                          DatabaseException.ErrorCode.UNSUPPORTED_INDEX_TYPE);

            Tests.Assert(root.idxBool.Remove(rfFirst));
            Tests.Assert(root.idxByte.Remove(rfFirst));
            Tests.Assert(root.idxSByte.Remove(rfFirst));
            Tests.Assert(root.idxShort.Remove(rfFirst));
            Tests.Assert(root.idxUShort.Remove(rfFirst));
            Tests.Assert(root.idxInt.Remove(rfFirst));
            Tests.Assert(root.idxUInt.Remove(rfFirst));
            Tests.Assert(root.idxLong.Remove(rfFirst));
            Tests.Assert(root.idxULong.Remove(rfFirst));
            Tests.Assert(root.idxFloat.Remove(rfFirst));
            Tests.Assert(root.idxDouble.Remove(rfFirst));
            Tests.Assert(root.idxDate.Remove(rfFirst));
            Tests.Assert(root.idxDecimal.Remove(rfFirst));
            Tests.Assert(root.idxGuid.Remove(rfFirst));
            Tests.Assert(root.idxString.Remove(rfFirst));
            db.Commit();
            Tests.Assert(!root.idxBool.Remove(rfFirst));
            Tests.Assert(!root.idxByte.Remove(rfFirst));
            Tests.Assert(!root.idxSByte.Remove(rfFirst));
            Tests.Assert(!root.idxShort.Remove(rfFirst));
            Tests.Assert(!root.idxUShort.Remove(rfFirst));
            Tests.Assert(!root.idxInt.Remove(rfFirst));
            Tests.Assert(!root.idxUInt.Remove(rfFirst));
            Tests.Assert(!root.idxLong.Remove(rfFirst));
            Tests.Assert(!root.idxLongProp.Remove(rfFirst));
            Tests.Assert(!root.idxULong.Remove(rfFirst));
            Tests.Assert(!root.idxFloat.Remove(rfFirst));
            Tests.Assert(!root.idxDouble.Remove(rfFirst));
            Tests.Assert(!root.idxDate.Remove(rfFirst));
            Tests.Assert(!root.idxDecimal.Remove(rfFirst));
            Tests.Assert(!root.idxGuid.Remove(rfFirst));
            Tests.Assert(!root.idxString.Remove(rfFirst));
            db.Commit();
            var e = root.idxLong.GetEnumerator();

            Tests.Assert(e.MoveNext());
            rFullNew = e.Current;
            Tests.Assert(root.idxLongProp.Remove(rFullNew));
            db.Commit();
            Tests.Assert(!root.idxLongProp.Remove(rFullNew));
        }
Example #2
0
        public void Run(TestConfig config)
        {
            int count = config.Count;
            var res = new TestResult();
            config.Result = res;

            IDatabase db = config.GetDatabase();
            Tests.Assert(db.Root == null);
            Root root = new Root();

            Tests.AssertDatabaseException(() =>
                { root.idx = db.CreateFieldIndex<RecordFullWithProperty>(new string[] { "NonExistent" }, IndexType.NonUnique); },
                DatabaseException.ErrorCode.INDEXED_FIELD_NOT_FOUND);

            root.idx = db.CreateFieldIndex<RecordFullWithProperty>(new string[] { "Int64Prop", "StrVal" }, IndexType.Unique);
            root.idxNonUnique = db.CreateFieldIndex<RecordFullWithProperty>(new string[] { "Int64Val", "ByteVal" }, IndexType.NonUnique);
            db.Root = root;
            Tests.Assert(root.idx.IndexedClass == typeof(RecordFullWithProperty));
            Tests.Assert(root.idx.KeyField.Name == "Int64Prop");
            Tests.Assert(root.idx.KeyFields[1].Name == "StrVal");

            Tests.AssertDatabaseException(() =>
                { root.idx.Append(new RecordFullWithProperty(0)); },
                DatabaseException.ErrorCode.UNSUPPORTED_INDEX_TYPE);

            RecordFullWithProperty rFirst = null;
            long firstkey = 0;
            foreach (var key in Tests.KeySeq(count))
            {
                RecordFullWithProperty rec = new RecordFullWithProperty(key);
                root.idx.Put(rec);
                root.idxNonUnique.Put(rec);
                if (rFirst == null)
                {
                    rFirst = rec;
                    firstkey = key;
                }
            }
            Tests.Assert(root.idx.Count == count);
            db.Commit();
            Tests.Assert(root.idx.Count == count);
            Tests.Assert(rFirst.IsPersistent());

            Tests.Assert(root.idx.Contains(rFirst));
            Tests.Assert(root.idxNonUnique.Contains(rFirst));

            var rTmp = new RecordFullWithProperty(firstkey);
            Tests.Assert(!root.idx.Contains(rTmp));
            Tests.Assert(!root.idxNonUnique.Contains(rTmp));

            RecordFullWithProperty[] recs = root.idx.ToArray();
            Tests.Assert(recs.Length == count);

            // TODO: figure out why Set() returns null
            var removed = root.idx.Set(rTmp);
            //Tests.Assert(removed == rFirst);
            removed = root.idxNonUnique.Set(rTmp);
            //Tests.Assert(removed == rFirst);

            long minKey = Int32.MaxValue;
            long maxKey = Int32.MinValue;
            foreach (var key in Tests.KeySeq(count))
            {
                String strKey = Convert.ToString(key);
                RecordFullWithProperty rec = root.idx.Get(new Key(new Object[] { key, strKey }));
                Tests.Assert(rec != null && rec.Int64Val == key && rec.StrVal.Equals(strKey));
                if (key < minKey)
                    minKey = key;
                if (key > maxKey)
                    maxKey = key;
            }

            int n = 0;
            string prevStr = "";
            long prevInt = minKey;
            foreach (RecordFullWithProperty rec in root.idx.Range(new Key(minKey, ""),
                                              new Key(maxKey + 1, "???"),
                                              IterationOrder.AscentOrder))
            {
                Tests.Assert(rec.Int64Val > prevInt || rec.Int64Val == prevInt && rec.StrVal.CompareTo(prevStr) > 0);
                prevStr = rec.StrVal;
                prevInt = rec.Int64Val;
                n += 1;
            }
            Tests.Assert(n == count);

            n = 0;
            prevInt = maxKey + 1;
            foreach (RecordFullWithProperty rec in root.idx.Range(new Key(minKey, "", false),
                                              new Key(maxKey + 1, "???", false),
                                              IterationOrder.DescentOrder))
            {
                Tests.Assert(rec.Int64Val < prevInt || rec.Int64Val == prevInt && rec.StrVal.CompareTo(prevStr) < 0);
                prevStr = rec.StrVal;
                prevInt = rec.Int64Val;
                n += 1;
            }
            Tests.Assert(n == count);

            rFirst = root.idx.ToArray()[0];
            Tests.Assert(root.idx.Contains(rFirst));
            Tests.Assert(root.idx.Remove(rFirst));
            Tests.Assert(!root.idx.Contains(rFirst));
            Tests.Assert(!root.idx.Remove(rFirst));

            rFirst = root.idxNonUnique.ToArray()[0];
            Tests.Assert(root.idxNonUnique.Contains(rFirst));
            Tests.Assert(root.idxNonUnique.Remove(rFirst));
            Tests.Assert(!root.idxNonUnique.Contains(rFirst));
            Tests.Assert(!root.idxNonUnique.Remove(rFirst));

            foreach (var o in root.idx.ToArray())
            {
                long key = o.Int64Val;
                String strKey = Convert.ToString(key);
                RecordFullWithProperty rec = root.idx.Get(new Key(new Object[] { key, strKey }));
                Tests.Assert(rec != null && rec.Int64Val == key && rec.StrVal.Equals(strKey));
                Tests.Assert(root.idx.Contains(rec));
                root.idx.Remove(rec);
            }
            Tests.Assert(!root.idx.GetEnumerator().MoveNext());
            Tests.Assert(!root.idx.Reverse().GetEnumerator().MoveNext());

            db.Close();
        }
Example #3
0
        public void Run(TestConfig config)
        {
            int count = config.Count;
            var res = new TestResult();
            config.Result = res;

            IDatabase db = config.GetDatabase();
            Tests.Assert(db.Root == null);
            Root root = new Root();
            Tests.AssertDatabaseException(() =>
                { root.idxBool = db.CreateFieldIndex<bool, RecordFullWithProperty>("NonExistent", IndexType.NonUnique); },
                DatabaseException.ErrorCode.INDEXED_FIELD_NOT_FOUND);

            Tests.AssertDatabaseException(() =>
                { root.idxBool = db.CreateFieldIndex<bool, RecordFullWithProperty>("CharVal", IndexType.NonUnique); },
                DatabaseException.ErrorCode.INCOMPATIBLE_KEY_TYPE);

            root.idxBool = db.CreateFieldIndex<bool, RecordFullWithProperty>("BoolVal", IndexType.NonUnique);
            root.idxByte = db.CreateFieldIndex<byte, RecordFullWithProperty>("ByteVal", IndexType.NonUnique);
            root.idxSByte = db.CreateFieldIndex<sbyte, RecordFullWithProperty>("SByteVal", IndexType.NonUnique);
            root.idxShort = db.CreateFieldIndex<short, RecordFullWithProperty>("Int16Val", IndexType.NonUnique);
            root.idxUShort = db.CreateFieldIndex<ushort, RecordFullWithProperty>("UInt16Val", IndexType.NonUnique);
            root.idxInt = db.CreateFieldIndex<int, RecordFullWithProperty>("Int32Val", IndexType.NonUnique);
            root.idxUInt = db.CreateFieldIndex<uint, RecordFullWithProperty>("UInt32Val", IndexType.NonUnique);
            root.idxLong = db.CreateFieldIndex<long, RecordFullWithProperty>("Int64Val", IndexType.Unique);
            root.idxLongProp = db.CreateFieldIndex<long, RecordFullWithProperty>("Int64Prop", IndexType.Unique);
            root.idxULong = db.CreateFieldIndex<ulong, RecordFullWithProperty>("UInt64Val", IndexType.NonUnique);
            //root.idxChar = db.CreateFieldIndex<char, RecordFullWithProperty>("CharVal", IndexType.NonUnique);
            root.idxFloat = db.CreateFieldIndex<float, RecordFullWithProperty>("FloatVal", IndexType.NonUnique);
            root.idxDouble = db.CreateFieldIndex<double, RecordFullWithProperty>("DoubleVal", IndexType.NonUnique);
            root.idxDate = db.CreateFieldIndex<DateTime, RecordFullWithProperty>("DateTimeVal", IndexType.NonUnique);
            root.idxDecimal = db.CreateFieldIndex<Decimal, RecordFullWithProperty>("DecimalVal", IndexType.NonUnique);
            root.idxGuid = db.CreateFieldIndex<Guid, RecordFullWithProperty>("GuidVal", IndexType.NonUnique);
            root.idxString = db.CreateFieldIndex<String, RecordFullWithProperty>("StrVal", IndexType.NonUnique);
            //root.idxEnum = db.CreateFieldIndex<RecordFullWithPropertyEnum, RecordFullWithProperty>("EnumVal", IndexType.NonUnique);
            //root.idxObject = db.CreateFieldIndex<object, RecordFullWithProperty>("ObjectVal", IndexType.NonUnique);
            root.idxOid = db.CreateFieldIndex<int, RecordFullWithProperty>("Oid", IndexType.NonUnique);

            root.idxIntAuto = db.CreateFieldIndex<int, RecordAuto>("IntAuto", IndexType.Unique);
            root.idxLongAuto = db.CreateFieldIndex<long, RecordAuto>("LongAuto", IndexType.Unique);
            db.Root = root;

            Tests.Assert(root.idxString.IndexedClass == typeof(RecordFullWithProperty));
            Tests.Assert(root.idxString.KeyField.Name == "StrVal");

            int i = 0;
            RecordFullWithProperty rfFirst = null;
            RecordAuto raFirst = null;
            long firstKey = 0;
            foreach (long key in Tests.KeySeq(count))
            {
                var r = new RecordFullWithProperty(key);
                root.idxBool.Put(r);
                root.idxByte.Put(r);
                root.idxSByte.Put(r);
                root.idxShort.Put(r);
                root.idxUShort.Put(r);
                root.idxInt.Put(r);
                root.idxUInt.Put(r);
                root.idxLong.Put(r);
                root.idxLongProp.Put(r);
                root.idxULong.Put(r);
                //root.idxChar.Put(r);
                root.idxFloat.Put(r);
                root.idxDouble.Put(r);
                root.idxDate.Put(r);
                root.idxDecimal.Put(r);
                root.idxGuid.Put(r);
                root.idxString.Put(r);
                //root.idxEnum.Put(r);
                //root.idxObject.Put(r);
                root.idxOid.Put(r);

                var ra = new RecordAuto();
                root.idxIntAuto.Append(ra);
                root.idxLongAuto.Append(ra);
                Tests.Assert(ra.IntAuto == i);
                Tests.Assert(ra.LongAuto == i);
                i++;
                if (null == rfFirst)
                {
                    rfFirst = r;
                    raFirst = ra;
                    firstKey = key;
                }
            }
            db.Commit();
            var r2 = new RecordFullWithProperty(firstKey);
            // Contains for unique index
            Tests.Assert(root.idxLong.Contains(rfFirst));
            Tests.Assert(!root.idxLong.Contains(r2));

            // Contains() for non-unique index
            Tests.Assert(root.idxInt.Contains(rfFirst));
            Tests.Assert(!root.idxInt.Contains(r2));

            Tests.Assert(false == root.idxLongProp.Put(r2));
            root.idxLongProp.Set(r2);

            Tests.AssertDatabaseException(() =>
                { root.idxString.Append(rfFirst); },
                DatabaseException.ErrorCode.UNSUPPORTED_INDEX_TYPE);

            Tests.Assert(root.idxBool.Remove(rfFirst));
            Tests.Assert(root.idxByte.Remove(rfFirst));
            Tests.Assert(root.idxSByte.Remove(rfFirst));
            Tests.Assert(root.idxShort.Remove(rfFirst));
            Tests.Assert(root.idxUShort.Remove(rfFirst));
            Tests.Assert(root.idxInt.Remove(rfFirst));
            Tests.Assert(root.idxUInt.Remove(rfFirst));
            Tests.Assert(root.idxLong.Remove(rfFirst));
            Tests.Assert(root.idxULong.Remove(rfFirst));
            Tests.Assert(root.idxFloat.Remove(rfFirst));
            Tests.Assert(root.idxDouble.Remove(rfFirst));
            Tests.Assert(root.idxDate.Remove(rfFirst));
            Tests.Assert(root.idxDecimal.Remove(rfFirst));
            Tests.Assert(root.idxGuid.Remove(rfFirst));
            Tests.Assert(root.idxString.Remove(rfFirst));
            db.Commit();
            Tests.Assert(!root.idxBool.Remove(rfFirst));
            Tests.Assert(!root.idxByte.Remove(rfFirst));
            Tests.Assert(!root.idxSByte.Remove(rfFirst));
            Tests.Assert(!root.idxShort.Remove(rfFirst));
            Tests.Assert(!root.idxUShort.Remove(rfFirst));
            Tests.Assert(!root.idxInt.Remove(rfFirst));
            Tests.Assert(!root.idxUInt.Remove(rfFirst));
            Tests.Assert(!root.idxLong.Remove(rfFirst));
            Tests.Assert(!root.idxLongProp.Remove(rfFirst));
            Tests.Assert(!root.idxULong.Remove(rfFirst));
            Tests.Assert(!root.idxFloat.Remove(rfFirst));
            Tests.Assert(!root.idxDouble.Remove(rfFirst));
            Tests.Assert(!root.idxDate.Remove(rfFirst));
            Tests.Assert(!root.idxDecimal.Remove(rfFirst));
            Tests.Assert(!root.idxGuid.Remove(rfFirst));
            Tests.Assert(!root.idxString.Remove(rfFirst));
            db.Commit();
            var e = root.idxLong.GetEnumerator();
            Tests.Assert(e.MoveNext());
            r2 = e.Current;
            Tests.Assert(root.idxLongProp.Remove(r2));
            db.Commit();
            Tests.Assert(!root.idxLongProp.Remove(r2));
        }
        public void Run(TestConfig config)
        {
            int count = config.Count;
            var res   = new TestResult();

            config.Result = res;

            IDatabase db = config.GetDatabase();

            Tests.Assert(db.Root == null);
            Root root = new Root();

            Tests.AssertDatabaseException(() =>
                                          { root.idx = db.CreateFieldIndex <RecordFullWithProperty>(new string[] { "NonExistent" }, IndexType.NonUnique); },
                                          DatabaseException.ErrorCode.INDEXED_FIELD_NOT_FOUND);

            root.idx          = db.CreateFieldIndex <RecordFullWithProperty>(new string[] { "Int64Prop", "StrVal" }, IndexType.Unique);
            root.idxNonUnique = db.CreateFieldIndex <RecordFullWithProperty>(new string[] { "Int64Val", "ByteVal" }, IndexType.NonUnique);
            db.Root           = root;
            Tests.Assert(root.idx.IndexedClass == typeof(RecordFullWithProperty));
            Tests.Assert(root.idx.KeyField.Name == "Int64Prop");
            Tests.Assert(root.idx.KeyFields[1].Name == "StrVal");

            Tests.AssertDatabaseException(() =>
                                          { root.idx.Append(new RecordFullWithProperty(0)); },
                                          DatabaseException.ErrorCode.UNSUPPORTED_INDEX_TYPE);

            RecordFullWithProperty rFirst = null;
            long firstkey = 0;

            foreach (var key in Tests.KeySeq(count))
            {
                RecordFullWithProperty rec = new RecordFullWithProperty(key);
                root.idx.Put(rec);
                root.idxNonUnique.Put(rec);
                if (rFirst == null)
                {
                    rFirst   = rec;
                    firstkey = key;
                }
            }
            Tests.Assert(root.idx.Count == count);
            db.Commit();
            Tests.Assert(root.idx.Count == count);
            Tests.Assert(rFirst.IsPersistent());

            Tests.Assert(root.idx.Contains(rFirst));
            Tests.Assert(root.idxNonUnique.Contains(rFirst));

            var rTmp = new RecordFullWithProperty(firstkey);

            Tests.Assert(!root.idx.Contains(rTmp));
            Tests.Assert(!root.idxNonUnique.Contains(rTmp));

            RecordFullWithProperty[] recs = root.idx.ToArray();
            Tests.Assert(recs.Length == count);

            // TODO: figure out why Set() returns null
            var removed = root.idx.Set(rTmp);

            //Tests.Assert(removed == rFirst);
            removed = root.idxNonUnique.Set(rTmp);
            //Tests.Assert(removed == rFirst);

            long minKey = Int32.MaxValue;
            long maxKey = Int32.MinValue;

            foreach (var key in Tests.KeySeq(count))
            {
                String strKey = Convert.ToString(key);
                RecordFullWithProperty rec = root.idx.Get(new Key(new Object[] { key, strKey }));
                Tests.Assert(rec != null && rec.Int64Val == key && rec.StrVal.Equals(strKey));
                if (key < minKey)
                {
                    minKey = key;
                }
                if (key > maxKey)
                {
                    maxKey = key;
                }
            }

            int    n       = 0;
            string prevStr = "";
            long   prevInt = minKey;

            foreach (RecordFullWithProperty rec in root.idx.Range(new Key(minKey, ""),
                                                                  new Key(maxKey + 1, "???"),
                                                                  IterationOrder.AscentOrder))
            {
                Tests.Assert(rec.Int64Val > prevInt || rec.Int64Val == prevInt && rec.StrVal.CompareTo(prevStr) > 0);
                prevStr = rec.StrVal;
                prevInt = rec.Int64Val;
                n      += 1;
            }
            Tests.Assert(n == count);

            n       = 0;
            prevInt = maxKey + 1;
            foreach (RecordFullWithProperty rec in root.idx.Range(new Key(minKey, "", false),
                                                                  new Key(maxKey + 1, "???", false),
                                                                  IterationOrder.DescentOrder))
            {
                Tests.Assert(rec.Int64Val < prevInt || rec.Int64Val == prevInt && rec.StrVal.CompareTo(prevStr) < 0);
                prevStr = rec.StrVal;
                prevInt = rec.Int64Val;
                n      += 1;
            }
            Tests.Assert(n == count);

            rFirst = root.idx.ToArray()[0];
            Tests.Assert(root.idx.Contains(rFirst));
            Tests.Assert(root.idx.Remove(rFirst));
            Tests.Assert(!root.idx.Contains(rFirst));
            Tests.Assert(!root.idx.Remove(rFirst));

            rFirst = root.idxNonUnique.ToArray()[0];
            Tests.Assert(root.idxNonUnique.Contains(rFirst));
            Tests.Assert(root.idxNonUnique.Remove(rFirst));
            Tests.Assert(!root.idxNonUnique.Contains(rFirst));
            Tests.Assert(!root.idxNonUnique.Remove(rFirst));

            foreach (var o in root.idx.ToArray())
            {
                long   key    = o.Int64Val;
                String strKey = Convert.ToString(key);
                RecordFullWithProperty rec = root.idx.Get(new Key(new Object[] { key, strKey }));
                Tests.Assert(rec != null && rec.Int64Val == key && rec.StrVal.Equals(strKey));
                Tests.Assert(root.idx.Contains(rec));
                root.idx.Remove(rec);
            }
            Tests.Assert(!root.idx.GetEnumerator().MoveNext());
            Tests.Assert(!root.idx.Reverse().GetEnumerator().MoveNext());

            db.Close();
        }