public static void VerifyBlocksCreated(BlockAllocationTableWriter table, int count)
        {
            MemoryStream stream = new MemoryStream();

            table.WriteBlocks(stream);
            byte[] output = stream.ToArray();

            Assert.AreEqual(count * 512, output.Length);
        }
        public void TestProduct()
        {
            BlockAllocationTableWriter table = new BlockAllocationTableWriter(POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS);

            for (int i = 1; i <= 22; i++)
                table.AllocateSpace(i);

            table.CreateBlocks();
            MemoryStream stream = new MemoryStream();

            table.WriteBlocks(stream);
            byte[] output = stream.ToArray();

            Assert.AreEqual(1024, output.Length);
            byte[] expected = new byte[1024];

            for (int i = 0; i < expected.Length; i++)
            {
                expected[i] = (byte)0xFF;
            }
            int offset = 0;
            int blockIndex = 1;

            for (int i = 1; i <= 22; i++)
            {
                int limit = i - 1;

                for (int j = 0; j < limit; j++)
                {
                    LittleEndian.PutInt(expected, offset, blockIndex++);
                    offset += LittleEndianConsts.INT_SIZE;
                }

                LittleEndian.PutInt(expected, offset, POIFSConstants.END_OF_CHAIN);

                offset += 4;
                blockIndex++;
            }

            LittleEndian.PutInt(expected, offset, blockIndex++);
            offset += LittleEndianConsts.INT_SIZE;
            LittleEndian.PutInt(expected, offset, POIFSConstants.END_OF_CHAIN);

            for (int i = 0; i < expected.Length; i++)
                Assert.AreEqual(expected[i], output[i], "At offset " + i);
        }