public void CheckBoolArray() { MemoryStream buffer = new MemoryStream(); IFieldWriter writer = new FieldWriter(buffer); IFieldReader reader = new FieldReader(buffer); bool[][] list = new bool[][] { new bool[0], new bool[1], new bool[2], new bool[31], new bool[32], new bool[33], new bool[63], new bool[64], new bool[65], new bool[127], new bool[128], new bool[129] }; Random rand = new Random(0); int bitCount = 0; for (int i = 0; i < list.Length; i++) { bool[] current = list[i]; bitCount += current.Length; for (int j = 0; j < current.Length; j++) { current[j] = rand.NextDouble() >= 0.5; } writer.Write(current); } Assert.AreEqual(675, bitCount); Assert.AreEqual(buffer.Length, buffer.Position); buffer.Position = 0; for (int i = 0; i < list.Length; i++) { bool[] current = list[i]; bool[] actual = reader.ReadBoolArray(); CompareArray(current, actual); } Assert.AreEqual(buffer.Length, buffer.Position); }