BytesOfLength() public static method

Gets a random array of bytes of the specified length.
public static BytesOfLength ( int numBytes ) : byte[]
numBytes int Number of bytes to be returned.
return byte[]
Example #1
0
        public void JetGetRecordSizeSeparated()
        {
            if (!EsentVersion.SupportsVistaFeatures)
            {
                return;
            }

            var size = new JET_RECSIZE();

            byte[] data = Any.BytesOfLength(64);
            Api.JetBeginTransaction(this.sesid);
            Api.JetPrepareUpdate(this.sesid, this.tableid, JET_prep.Insert);
            Api.JetSetColumn(this.sesid, this.tableid, this.columnidLongText, data, data.Length, SetColumnGrbit.SeparateLV, null);
            VistaApi.JetGetRecordSize(this.sesid, this.tableid, ref size, GetRecordSizeGrbit.InCopyBuffer);
            this.UpdateAndGotoBookmark();
            VistaApi.JetGetRecordSize(this.sesid, this.tableid, ref size, GetRecordSizeGrbit.RunningTotal);

            Assert.AreEqual(0, size.cbData, "cbData");
            Assert.AreEqual(0, size.cbDataCompressed, "cbDataCompressed");
            Assert.AreEqual(data.Length * 2, size.cbLongValueData, "cbLongValueData");
            Assert.AreEqual(data.Length * 2, size.cbLongValueDataCompressed, "cbLongValueDataCompressed");
            Assert.AreNotEqual(0, size.cbLongValueOverhead, "cbLongValueOverhead");
            Assert.AreNotEqual(0, size.cbOverhead, "cbOverhead");
            Assert.AreEqual(0, size.cCompressedColumns, "cCompressedColumns");
            Assert.AreEqual(2, size.cLongValues, "cLongValues");
            Assert.AreEqual(0, size.cMultiValues, "cMultiValues");
            Assert.AreEqual(0, size.cNonTaggedColumns, "cTaggedColumns");
            Assert.AreEqual(2, size.cTaggedColumns, "cTaggedColumns");
        }
        public void RetrieveColumnsWithLargeValues()
        {
            string str = Any.StringOfLength(129 * 1024);
            byte[] bytes = Any.BytesOfLength(127 * 1024);

            using (var trx = new Transaction(this.session))
            using (var update = new Update(this.session, this.tableid, JET_prep.Insert))
            {
                Api.SetColumn(this.session, this.tableid, this.columnDict["Unicode"], str, Encoding.Unicode);
                Api.SetColumn(this.session, this.tableid, this.columnDict["Binary"], bytes);

                update.SaveAndGotoBookmark();
                trx.Commit(CommitTransactionGrbit.None);
            }

            var columnValues = new ColumnValue[]
            {
                new StringColumnValue { Columnid = this.columnDict["Unicode"] },
                new BytesColumnValue { Columnid = this.columnDict["Binary"] },
            };

            Api.RetrieveColumns(this.session, this.tableid, columnValues);

            Assert.AreEqual(str, columnValues[0].ValueAsObject);
            CollectionAssert.AreEqual(bytes, columnValues[1].ValueAsObject as byte[]);
        }
        public void SetColumns()
        {
            bool bit = true;
            byte b = Any.Byte;
            short i16 = Any.Int16;
            ushort ui16 = Any.UInt16;
            int i32 = Any.Int32;
            uint ui32 = Any.UInt32;
            long i64 = Any.Int64;
            ulong ui64 = Any.UInt64;
            float f = Any.Float;
            double d = Any.Double;
            DateTime date = Any.DateTime;
            Guid guid = Any.Guid;
            string s = Any.String;
            byte[] bytes = Any.BytesOfLength(1023);

            var columnValues = new ColumnValue[]
            {
                new BoolColumnValue { Columnid = this.columnDict["Boolean"], Value = bit },
                new ByteColumnValue { Columnid = this.columnDict["Byte"], Value = b },
                new Int16ColumnValue { Columnid = this.columnDict["Int16"], Value = i16 },
                new UInt16ColumnValue { Columnid = this.columnDict["UInt16"], Value = ui16 },
                new Int32ColumnValue { Columnid = this.columnDict["Int32"], Value = i32 },
                new UInt32ColumnValue { Columnid = this.columnDict["UInt32"], Value = ui32 },
                new Int64ColumnValue { Columnid = this.columnDict["Int64"], Value = i64 },
                new UInt64ColumnValue { Columnid = this.columnDict["UInt64"], Value = ui64 },
                new FloatColumnValue { Columnid = this.columnDict["Float"], Value = f },
                new DoubleColumnValue { Columnid = this.columnDict["Double"], Value = d },
                new DateTimeColumnValue { Columnid = this.columnDict["DateTime"], Value = date },
                new GuidColumnValue() { Columnid = this.columnDict["Guid"], Value = guid },
                new StringColumnValue { Columnid = this.columnDict["Unicode"], Value = s },
                new BytesColumnValue { Columnid = this.columnDict["Binary"], Value = bytes },
            };

            using (var trx = new Transaction(this.session))
            using (var update = new Update(this.session, this.tableid, JET_prep.Insert))
            {
                Api.SetColumns(this.session, this.tableid, columnValues);
                update.Save();
                trx.Commit(CommitTransactionGrbit.None);
            }

            Api.TryMoveFirst(this.session, this.tableid);

            Assert.AreEqual(bit, Api.RetrieveColumnAsBoolean(this.session, this.tableid, this.columnDict["Boolean"]));
            Assert.AreEqual(b, Api.RetrieveColumnAsByte(this.session, this.tableid, this.columnDict["Byte"]));
            Assert.AreEqual(i16, Api.RetrieveColumnAsInt16(this.session, this.tableid, this.columnDict["Int16"]));
            Assert.AreEqual(ui16, Api.RetrieveColumnAsUInt16(this.session, this.tableid, this.columnDict["UInt16"]));
            Assert.AreEqual(i32, Api.RetrieveColumnAsInt32(this.session, this.tableid, this.columnDict["Int32"]));
            Assert.AreEqual(ui32, Api.RetrieveColumnAsUInt32(this.session, this.tableid, this.columnDict["UInt32"]));
            Assert.AreEqual(i64, Api.RetrieveColumnAsInt64(this.session, this.tableid, this.columnDict["Int64"]));
            Assert.AreEqual(ui64, Api.RetrieveColumnAsUInt64(this.session, this.tableid, this.columnDict["UInt64"]));
            Assert.AreEqual(f, Api.RetrieveColumnAsFloat(this.session, this.tableid, this.columnDict["Float"]));
            Assert.AreEqual(d, Api.RetrieveColumnAsDouble(this.session, this.tableid, this.columnDict["Double"]));
            Assert.AreEqual(date, Api.RetrieveColumnAsDateTime(this.session, this.tableid, this.columnDict["DateTime"]));
            Assert.AreEqual(guid, Api.RetrieveColumnAsGuid(this.session, this.tableid, this.columnDict["Guid"]));
            Assert.AreEqual(s, Api.RetrieveColumnAsString(this.session, this.tableid, this.columnDict["Unicode"]));
            CollectionAssert.AreEqual(bytes, Api.RetrieveColumn(this.session, this.tableid, this.columnDict["Binary"]));
        }
        public void GrowColumnStreamByWritingPastEnd()
        {
            var bookmark = new byte[SystemParameters.BookmarkMost];
            int bookmarkSize;

            const int Length   = 1345;
            const int Position = 1500;
            var       data     = Any.BytesOfLength(Length);

            using (var transaction = new Transaction(this.sesid))
                using (var update = new Update(this.sesid, this.tableid, JET_prep.Insert))
                    using (var stream = new ColumnStream(this.sesid, this.tableid, this.columnidLongText))
                    {
                        stream.Position = Position;
                        stream.Write(data, 0, data.Length);
                        update.Save(bookmark, bookmark.Length, out bookmarkSize);
                        transaction.Commit(CommitTransactionGrbit.LazyFlush);
                    }

            Api.JetGotoBookmark(this.sesid, this.tableid, bookmark, bookmarkSize);
            using (var stream = new ColumnStream(this.sesid, this.tableid, this.columnidLongText))
            {
                Assert.AreEqual(Length + Position, stream.Length);
                var expected = new byte[Length + Position];
                var actual   = new byte[Length + Position];
                Array.Copy(data, 0, expected, Position, Length);
                Assert.AreEqual(Length + Position, stream.Read(actual, 0, actual.Length));
                CollectionAssert.AreEqual(expected, actual);
            }
        }
        public void ReadReturnsNumberOfBytesRead()
        {
            var bookmark = new byte[SystemParameters.BookmarkMost];
            int bookmarkSize;

            var data = Any.BytesOfLength(1024);

            using (var transaction = new Transaction(this.sesid))
                using (var update = new Update(this.sesid, this.tableid, JET_prep.Insert))
                    using (var stream = new ColumnStream(this.sesid, this.tableid, this.columnidLongText))
                    {
                        stream.Write(data, 0, data.Length);
                        update.Save(bookmark, bookmark.Length, out bookmarkSize);
                        transaction.Commit(CommitTransactionGrbit.LazyFlush);
                    }

            Api.JetGotoBookmark(this.sesid, this.tableid, bookmark, bookmarkSize);
            using (var stream = new ColumnStream(this.sesid, this.tableid, this.columnidLongText))
            {
                var retrieved = new byte[data.Length];
                stream.Seek(-1, SeekOrigin.End);
                Assert.AreEqual(1, stream.Read(retrieved, 0, retrieved.Length));
                Assert.AreEqual(data[data.Length - 1], retrieved[0]);
            }
        }
        public void ShrinkColumnStream()
        {
            var bookmark = new byte[SystemParameters.BookmarkMost];
            int bookmarkSize;

            const int Length = 1345;
            var       data   = Any.BytesOfLength(Length);

            using (var transaction = new Transaction(this.sesid))
                using (var update = new Update(this.sesid, this.tableid, JET_prep.Insert))
                    using (var stream = new ColumnStream(this.sesid, this.tableid, this.columnidLongText))
                    {
                        stream.Write(data, 0, data.Length);
                        stream.Write(data, 0, data.Length);
                        Assert.AreEqual(Length * 2, stream.Length);

                        stream.SetLength(Length);
                        Assert.AreEqual(Length, stream.Length);

                        update.Save(bookmark, bookmark.Length, out bookmarkSize);
                        transaction.Commit(CommitTransactionGrbit.LazyFlush);
                    }

            Api.JetGotoBookmark(this.sesid, this.tableid, bookmark, bookmarkSize);
            using (var stream = new ColumnStream(this.sesid, this.tableid, this.columnidLongText))
            {
                Assert.AreEqual(Length, stream.Length);
                var buffer = new byte[Length];
                stream.Read(buffer, 0, buffer.Length);
                CollectionAssert.AreEqual(data, buffer);
            }
        }
        public void ExtendingColumnStream()
        {
            var bookmark = new byte[SystemParameters.BookmarkMost];
            int bookmarkSize;

            var data = Any.BytesOfLength(4096);

            using (var transaction = new Transaction(this.sesid))
                using (var update = new Update(this.sesid, this.tableid, JET_prep.Insert))
                    using (var stream = new ColumnStream(this.sesid, this.tableid, this.columnidLongText))
                    {
                        // Write some of the data, rewind a bit and then overwrite the
                        // last few bytes and append some more data
                        stream.Write(data, 0, data.Length - 10);
                        stream.Seek(-10, SeekOrigin.End);
                        stream.Write(data, data.Length - 20, 20);
                        update.Save(bookmark, bookmark.Length, out bookmarkSize);
                        transaction.Commit(CommitTransactionGrbit.LazyFlush);
                    }

            Api.JetGotoBookmark(this.sesid, this.tableid, bookmark, bookmarkSize);
            using (var stream = new ColumnStream(this.sesid, this.tableid, this.columnidLongText))
            {
                Assert.AreEqual(data.Length, stream.Length);
                var retrieved = new byte[data.Length];
                Assert.AreEqual(retrieved.Length, stream.Read(retrieved, 0, retrieved.Length));
                CollectionAssert.AreEqual(data, retrieved);
            }
        }
        public void OverwriteColumnStream()
        {
            var bookmark = new byte[SystemParameters.BookmarkMost];
            int bookmarkSize;

            var       data    = Any.BytesOfLength(1024);
            var       newData = Any.BytesOfLength(128);
            const int Offset  = 10;

            using (var transaction = new Transaction(this.sesid))
                using (var update = new Update(this.sesid, this.tableid, JET_prep.Insert))
                    using (var stream = new ColumnStream(this.sesid, this.tableid, this.columnidLongText))
                    {
                        stream.Write(data, 0, data.Length);
                        stream.Position = 0;
                        stream.Seek(Offset, SeekOrigin.Current);
                        stream.Write(newData, 0, newData.Length);
                        update.Save(bookmark, bookmark.Length, out bookmarkSize);
                        transaction.Commit(CommitTransactionGrbit.LazyFlush);
                    }

            Api.JetGotoBookmark(this.sesid, this.tableid, bookmark, bookmarkSize);
            using (var stream = new ColumnStream(this.sesid, this.tableid, this.columnidLongText))
            {
                Assert.AreEqual(data.Length, stream.Length);
                var retrieved = new byte[data.Length];
                var expected  = new byte[data.Length];
                Array.Copy(data, 0, expected, 0, data.Length);
                Array.Copy(newData, 0, expected, Offset, newData.Length);
                Assert.AreEqual(retrieved.Length, stream.Read(retrieved, 0, retrieved.Length));
                CollectionAssert.AreEqual(expected, retrieved);
            }
        }
        public void ReadAtNonZeroOffset()
        {
            var bookmark = new byte[SystemParameters.BookmarkMost];
            int bookmarkSize;

            var data = Any.BytesOfLength(1024);

            using (var transaction = new Transaction(this.sesid))
                using (var update = new Update(this.sesid, this.tableid, JET_prep.Insert))
                    using (var stream = new ColumnStream(this.sesid, this.tableid, this.columnidLongText))
                    {
                        stream.Write(data, 0, data.Length);
                        update.Save(bookmark, bookmark.Length, out bookmarkSize);
                        transaction.Commit(CommitTransactionGrbit.LazyFlush);
                    }

            Api.JetGotoBookmark(this.sesid, this.tableid, bookmark, bookmarkSize);
            using (var stream = new ColumnStream(this.sesid, this.tableid, this.columnidLongText))
            {
                var retrieved = new byte[data.Length * 2];
                stream.Read(retrieved, data.Length, data.Length);
                for (int i = data.Length; i < retrieved.Length; ++i)
                {
                    Assert.AreEqual(retrieved[i], data[i - data.Length]);
                }
            }
        }
Example #10
0
        public void JetSetColumns()
        {
            byte   b   = Any.Byte;
            short  s   = Any.Int16;
            int    i   = Any.Int32;
            long   l   = Any.Int64;
            string str = Any.String;
            float  f   = Any.Float;
            double d   = Any.Double;

            byte[] data = Any.BytesOfLength(1023);

            var setcolumns = new[]
            {
                new JET_SETCOLUMN {
                    cbData = sizeof(byte), columnid = this.columnDict["Byte"], pvData = BitConverter.GetBytes(b)
                },
                new JET_SETCOLUMN {
                    cbData = sizeof(short), columnid = this.columnDict["Int16"], pvData = BitConverter.GetBytes(s)
                },
                new JET_SETCOLUMN {
                    cbData = sizeof(int), columnid = this.columnDict["Int32"], pvData = BitConverter.GetBytes(i)
                },
                new JET_SETCOLUMN {
                    cbData = sizeof(long), columnid = this.columnDict["Int64"], pvData = BitConverter.GetBytes(l)
                },
                new JET_SETCOLUMN {
                    cbData = sizeof(float), columnid = this.columnDict["Float"], pvData = BitConverter.GetBytes(f)
                },
                new JET_SETCOLUMN {
                    cbData = sizeof(double), columnid = this.columnDict["Double"], pvData = BitConverter.GetBytes(d)
                },
                new JET_SETCOLUMN {
                    cbData = str.Length * sizeof(char), columnid = this.columnDict["Unicode"], pvData = Encoding.Unicode.GetBytes(str)
                },
                new JET_SETCOLUMN {
                    cbData = data.Length, columnid = this.columnDict["Binary"], pvData = data
                },
            };

            using (var trx = new Transaction(this.session))
                using (var update = new Update(this.session, this.tableid, JET_prep.Insert))
                {
                    Api.JetSetColumns(this.session, this.tableid, setcolumns, setcolumns.Length);
                    update.Save();
                    trx.Commit(CommitTransactionGrbit.None);
                }

            Api.TryMoveFirst(this.session, this.tableid);

            Assert.AreEqual(b, Api.RetrieveColumnAsByte(this.session, this.tableid, this.columnDict["Byte"]));
            Assert.AreEqual(s, Api.RetrieveColumnAsInt16(this.session, this.tableid, this.columnDict["Int16"]));
            Assert.AreEqual(i, Api.RetrieveColumnAsInt32(this.session, this.tableid, this.columnDict["Int32"]));
            Assert.AreEqual(l, Api.RetrieveColumnAsInt64(this.session, this.tableid, this.columnDict["Int64"]));
            Assert.AreEqual(f, Api.RetrieveColumnAsFloat(this.session, this.tableid, this.columnDict["Float"]));
            Assert.AreEqual(d, Api.RetrieveColumnAsDouble(this.session, this.tableid, this.columnDict["Double"]));
            Assert.AreEqual(str, Api.RetrieveColumnAsString(this.session, this.tableid, this.columnDict["Unicode"]));
            CollectionAssert.AreEqual(data, Api.RetrieveColumn(this.session, this.tableid, this.columnDict["Binary"]));
        }
Example #11
0
        public void Setup()
        {
            Thread.CurrentThread.Priority = ThreadPriority.Highest;

            this.directory = SetupHelper.CreateRandomDirectory();

            this.random  = new Random();
            this.data    = Any.BytesOfLength(DataSize);
            this.dataBuf = new byte[DataSize];

            JET_DBID dbid;

            string ignored;

            Api.JetGetSystemParameter(
                JET_INSTANCE.Nil, JET_SESID.Nil, JET_param.CacheSizeMin, ref this.cacheSizeMinSaved, out ignored, 0);
            Api.JetSetSystemParameter(JET_INSTANCE.Nil, JET_SESID.Nil, JET_param.CacheSizeMin, 16384, null);

            this.instance = new Instance("SimplePerfTest");
            this.instance.Parameters.LogFileDirectory = this.directory;
            this.instance.Parameters.SystemDirectory  = this.directory;
            this.instance.Parameters.MaxVerPages      = 1024;
            this.instance.Parameters.Recovery         = false;

            // Create the instance, database and table
            this.instance.Init();
            this.session = new Session(this.instance);
            Api.JetCreateDatabase(this.session, Path.Combine(this.directory, "esentperftest.db"), string.Empty, out dbid, CreateDatabaseGrbit.None);

            // Create a dummy table to force the database to grow
            using (var trx = new Transaction(this.session))
            {
                JET_TABLEID tableid;
                Api.JetCreateTable(this.session, dbid, "dummy_table", 64 * 1024 * 1024 / SystemParameters.DatabasePageSize, 100, out tableid);
                Api.JetCloseTable(this.session, tableid);
                Api.JetDeleteTable(this.session, dbid, "dummy_table");
                trx.Commit(CommitTransactionGrbit.LazyFlush);
            }

            // Create the table
            using (var trx = new Transaction(this.session))
            {
                JET_TABLEID tableid;
                var         columndef = new JET_COLUMNDEF();

                Api.JetCreateTable(this.session, dbid, "table", 0, 100, out tableid);
                columndef.coltyp = JET_coltyp.Currency;
                Api.JetAddColumn(this.session, tableid, "Key", columndef, null, 0, out this.columnidKey);
                columndef.coltyp = JET_coltyp.Binary;
                Api.JetAddColumn(this.session, tableid, "Data", columndef, null, 0, out this.columnidData);
                Api.JetCreateIndex(this.session, tableid, "primary", CreateIndexGrbit.IndexPrimary, "+key\0\0", 6, 100);
                Api.JetCloseTable(this.session, tableid);
                trx.Commit(CommitTransactionGrbit.None);
            }

            this.table = new Table(this.session, dbid, "table", OpenTableGrbit.None);
        }
Example #12
0
        public void VerifyColumnInfoDefaultValueIsReadOnly()
        {
            var columnInfo = new ColumnInfo(
                "column",
                JET_COLUMNID.Nil,
                JET_coltyp.LongText,
                JET_CP.Unicode,
                8,
                Any.BytesOfLength(8),
                ColumndefGrbit.ColumnFixed);

            columnInfo.DefaultValue[0] = 0x1;
        }
        public void SetColumnStreamPosition()
        {
            var bookmark = new byte[SystemParameters.BookmarkMost];
            int bookmarkSize;

            using (var transaction = new Transaction(this.sesid))
                using (var update = new Update(this.sesid, this.tableid, JET_prep.Insert))
                    using (var stream = new ColumnStream(this.sesid, this.tableid, this.columnidLongText))
                    {
                        stream.Write(Any.BytesOfLength(1024), 0, 1024);
                        update.Save(bookmark, bookmark.Length, out bookmarkSize);
                        transaction.Commit(CommitTransactionGrbit.LazyFlush);
                    }

            Api.JetGotoBookmark(this.sesid, this.tableid, bookmark, bookmarkSize);
            using (var stream = new ColumnStream(this.sesid, this.tableid, this.columnidLongText))
            {
                stream.Position = 10;
                Assert.AreEqual(10, stream.Position);
            }
        }
Example #14
0
        public void RetrieveColumns()
        {
            bool bit = Any.Boolean;
            byte b = Any.Byte;
            short i16 = Any.Int16;
            ushort ui16 = Any.UInt16;
            int i32 = Any.Int32;
            uint ui32 = Any.UInt32;
            long i64 = Any.Int64;
            ulong ui64 = Any.UInt64;
            float f = Any.Float;
            double d = Any.Double;
            DateTime date = Any.DateTime;
            Guid guid = Any.Guid;
            string str = Any.String;
            byte[] bytes = Any.BytesOfLength(1023);

            using (var trx = new Transaction(this.session))
            using (var update = new Update(this.session, this.tableid, JET_prep.Insert))
            {
                Api.SetColumn(this.session, this.tableid, this.columnDict["Boolean"], bit);
                Api.SetColumn(this.session, this.tableid, this.columnDict["Byte"], b);
                Api.SetColumn(this.session, this.tableid, this.columnDict["Int16"], i16);
                Api.SetColumn(this.session, this.tableid, this.columnDict["UInt16"], ui16);
                Api.SetColumn(this.session, this.tableid, this.columnDict["Int32"], i32);
                Api.SetColumn(this.session, this.tableid, this.columnDict["UInt32"], ui32);
                Api.SetColumn(this.session, this.tableid, this.columnDict["Int64"], i64);
                Api.SetColumn(this.session, this.tableid, this.columnDict["UInt64"], ui64);
                Api.SetColumn(this.session, this.tableid, this.columnDict["Float"], f);
                Api.SetColumn(this.session, this.tableid, this.columnDict["Double"], d);
                Api.SetColumn(this.session, this.tableid, this.columnDict["DateTime"], date);
                Api.SetColumn(this.session, this.tableid, this.columnDict["Guid"], guid);
                Api.SetColumn(this.session, this.tableid, this.columnDict["Unicode"], str, Encoding.Unicode);
                Api.SetColumn(this.session, this.tableid, this.columnDict["Binary"], bytes);

                update.SaveAndGotoBookmark();
                trx.Commit(CommitTransactionGrbit.None);
            }

            var columnValues = new ColumnValue[]
            {
                new BoolColumnValue { Columnid = this.columnDict["Boolean"] },
                new ByteColumnValue { Columnid = this.columnDict["Byte"] },
                new Int16ColumnValue { Columnid = this.columnDict["Int16"] },
                new UInt16ColumnValue { Columnid = this.columnDict["UInt16"] },
                new Int32ColumnValue { Columnid = this.columnDict["Int32"] },
                new UInt32ColumnValue { Columnid = this.columnDict["UInt32"] },
                new Int64ColumnValue { Columnid = this.columnDict["Int64"] },
                new UInt64ColumnValue { Columnid = this.columnDict["UInt64"] },
                new FloatColumnValue { Columnid = this.columnDict["Float"] },
                new DoubleColumnValue { Columnid = this.columnDict["Double"] },
                new DateTimeColumnValue { Columnid = this.columnDict["DateTime"] },
                new GuidColumnValue { Columnid = this.columnDict["Guid"] },
                new StringColumnValue { Columnid = this.columnDict["Unicode"] },
                new BytesColumnValue { Columnid = this.columnDict["Binary"] },
            };

            Api.RetrieveColumns(this.session, this.tableid, columnValues);

            Assert.AreEqual(bit, columnValues[0].ValueAsObject);
            Assert.AreEqual(b, columnValues[1].ValueAsObject);
            Assert.AreEqual(i16, columnValues[2].ValueAsObject);
            Assert.AreEqual(ui16, columnValues[3].ValueAsObject);
            Assert.AreEqual(i32, columnValues[4].ValueAsObject);
            Assert.AreEqual(ui32, columnValues[5].ValueAsObject);
            Assert.AreEqual(i64, columnValues[6].ValueAsObject);
            Assert.AreEqual(ui64, columnValues[7].ValueAsObject);
            Assert.AreEqual(f, columnValues[8].ValueAsObject);
            Assert.AreEqual(d, columnValues[9].ValueAsObject);
            Assert.AreEqual(date, columnValues[10].ValueAsObject);
            Assert.AreEqual(guid, columnValues[11].ValueAsObject);
            Assert.AreEqual(str, columnValues[12].ValueAsObject);
            CollectionAssert.AreEqual(bytes, columnValues[13].ValueAsObject as byte[]);
        }
Example #15
0
 public void TestAnyBytesOfLengthIsCorrectLength()
 {
     byte[] s = Any.BytesOfLength(20);
     Assert.AreEqual(20, s.Length);
 }