public void Combo1()
        {
            object  val       = null;
            object  testValue = null;
            BVector d         = new BVector();
            int     itemCount = 1000;

            object[] values = new object[itemCount];

            for (int i = 0; i < itemCount; i++)
            {
                val       = BHelper.WriteRandomValue(d);
                values[i] = val;
            }

            for (int i = 0; i < itemCount; i++)
            {
                val       = values[i];
                testValue = BHelper.ReadNextRandomValue(d);
                var valueType = val.GetType();

                // Assert.AreEqual cannot compare byte[] since it is using reference equality
                if (valueType.IsArray && valueType.GetElementType() == typeof(byte))
                {
                    Assert.IsTrue(BHelper.CompareByteArrays((byte[])val, (byte[])testValue));
                }
                else
                {
                    Assert.AreEqual(val, testValue);
                }
            }
        }
示例#2
0
        public void String_Unicode()
        {
            string  unicodeChars = BHelper.GetUnicodeCharacters();
            BVector d            = new BVector();

            d.Add(unicodeChars);
            string stored = d.GetString();

            Assert.AreEqual(unicodeChars, stored);
        }
        public void ByteArray_Basic()
        {
            var     rnd        = new CryptoRandom();
            int     itemsCount = 1_000;
            BVector d          = new BVector();

            byte[] values = rnd.NextBytes(itemsCount);

            d.Add(values);
            Assert.IsTrue(BHelper.CompareByteArrays(values, d.GetByteArray()));
        }