public void ArrayWithNullItem()
        {
            Faker f     = new Faker();
            int   count = f.Random.Int(1, 10);

            TestObject[] x0 = Generator.Array(count, g => TestObject.Generate());
            x0[count - 1] = null;
            Assert.Throws <ArgumentNullException>(() => ArrayToBytes(x0));
        }
        public void Object(bool bigEndian)
        {
            TestObject x0 = TestObject.Generate();

            byte[]     data = Serializer.Write(x0, bigEndian);
            TestObject x1   = Serializer.Read <TestObject>(data, bigEndian);

            Assert.Equal(x0, x1);
            Assert.Equal(Serializer.SizeOfType <TestObject>(), data.Length);
        }
        public void ObjectArrayFixedLength(bool bigEndian, int bufferCount, int initialCount, int expectedCount)
        {
            Faker f = new Faker();

            TestObject[] x0   = Generator.Array(initialCount, g => TestObject.Generate());
            byte[]       data = ArrayToBytes(x0, bufferCount, bigEndian: bigEndian);
            TestObject[] x1   = BytesToArray <TestObject>(data, bufferCount, bigEndian: bigEndian);

            Assert.Equal(initialCount, x0.Length);
            Assert.Equal(expectedCount, x1.Length);
            Assert.Equal(x0.Take(Math.Min(bufferCount, initialCount)), x1.Take(Math.Min(bufferCount, initialCount)));
            Assert.Equal(Serializer.SizeOfType <TestObject>() * bufferCount, data.Length);
        }
        public void ObjectArray(bool bigEndian)
        {
            Faker f     = new Faker();
            int   count = f.Random.Int(1, 10);

            TestObject[] x0   = Generator.Array(count, g => TestObject.Generate());
            byte[]       data = ArrayToBytes(x0, bigEndian: bigEndian);
            TestObject[] x1   = BytesToArray <TestObject>(data, count, bigEndian: bigEndian);

            Assert.Equal(count, x1.Length);
            Assert.Equal(x0, x1);
            Assert.Equal(Serializer.SizeOfType <TestObject>() * count, data.Length);
        }