public void ReadBooleanArrayBigEndian () { byte[] data = new byte[] { 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1 }; MessageReader reader = new MessageReader (EndianFlag.Big, data); bool[] array = (bool[])reader.ReadArray (typeof (bool)); Assert.IsNotNull (array); Assert.AreEqual (4, array.Length, "length"); CollectionAssert.AreEqual (new bool[] { true, false, true, true}, array, "elements"); Assert.IsFalse (reader.DataAvailable); }
public void ReadIntArrayBigEndian () { byte[] data = new byte[] { 0, 0, 0, 16, 0, 0, 8, 8, 0, 0, 8, 8, 0, 0, 8, 8, 0, 0, 8, 8 }; MessageReader reader = new MessageReader (EndianFlag.Big, data); int[] array = (int[])reader.ReadArray (typeof (int)); Assert.IsNotNull (array); Assert.AreEqual (4, array.Length, "length"); CollectionAssert.AreEqual (new int[] { 0x808, 0x808, 0x808, 0x808}, array, "elements"); Assert.IsFalse (reader.DataAvailable); }