示例#1
0
        public void FormatLongerThanMaxWidthTest()
        {
            BinaryColumnFormat format = new BinaryColumnFormat(10);
            var result = format.Format(new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 });

            Assert.AreEqual("0x000102030405060708090A", result);
        }
示例#2
0
        public void FormatSingleByteTest3()
        {
            BinaryColumnFormat format = new BinaryColumnFormat(10);
            var result = format.Format(new byte[] { 255 });

            Assert.AreEqual("0xFF", result);
        }
示例#3
0
        public void FormatEmptyTest()
        {
            BinaryColumnFormat format = new BinaryColumnFormat(10);
            var result = format.Format(new byte[] {});

            Assert.AreEqual("0x", result);
        }
示例#4
0
        public void FormatShorterThanMaxWidthTest()
        {
            BinaryColumnFormat format = new BinaryColumnFormat(10);
            var result = format.Format(new byte[] { 0 });

            Assert.AreEqual("0x00", result);
        }
示例#5
0
        public void FormatNullTest()
        {
            BinaryColumnFormat format = new BinaryColumnFormat(10);
            var result = format.Format(DBNull.Value);

            Assert.AreEqual(ColumnFormat.NullText, result);
        }
示例#6
0
        public void AutoFormatTest2()
        {
            BinaryColumnFormat format = new BinaryColumnFormat(10);

            byte[][] values = new byte[][]
            {
                new byte[] { 0 }
            };
            format.AutoFormat(values, false);

            // Not less than the characters required to display null values.
            Assert.AreEqual(ColumnFormat.NullText.Length, format.MaxWidth);
        }
示例#7
0
        public void AutoFormatTest1()
        {
            BinaryColumnFormat format = new BinaryColumnFormat(10);

            byte[][] values = new byte[][]
            {
                new byte[] { 0 },
                new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 },
            };
            format.AutoFormat(values, false);

            Assert.AreEqual(22, format.MaxWidth);
        }