public void TestBytes()
{
for (int i = 0; i < ITERATIONS; i++)
{
int length = random.Next(5, 5000);
byte[] expectedValue = new byte[length];
random.NextBytes(expectedValue);
MemoryStream iostr = new MemoryStream();
BinaryEncoder.Instance.WriteBytes(iostr, expectedValue);
iostr.Position = 0;
byte[] actual = BinaryDecoder.Instance.ReadBytes(iostr);
Assert.IsTrue(
ArrayHelper<byte>.Equals(expectedValue, actual)
, "Iteration {0:###,###,###,##0}", i);
}
}
}