public virtual void ConsiderBytesTest()
        {
            MemoryLimitsAwareHandler handler = new MemoryLimitsAwareHandler();
            long state1 = handler.GetAllMemoryUsedForDecompression();

            handler.ConsiderBytesOccupiedByDecompressedPdfStream(100);
            long state2 = handler.GetAllMemoryUsedForDecompression();

            NUnit.Framework.Assert.AreEqual(state1, state2);
            handler.BeginDecompressedPdfStreamProcessing();
            handler.ConsiderBytesOccupiedByDecompressedPdfStream(100);
            long state3 = handler.GetAllMemoryUsedForDecompression();

            NUnit.Framework.Assert.AreEqual(state1, state3);
            handler.ConsiderBytesOccupiedByDecompressedPdfStream(80);
            long state4 = handler.GetAllMemoryUsedForDecompression();

            NUnit.Framework.Assert.AreEqual(state1, state4);
            handler.EndDecompressedPdfStreamProcessing();
            long state5 = handler.GetAllMemoryUsedForDecompression();

            NUnit.Framework.Assert.AreEqual(state1 + 100, state5);
        }
        private static void TestMultipleStreams(MemoryLimitsAwareHandler handler)
        {
            String expectedExceptionMessage = PdfException.DuringDecompressionMultipleStreamsInSumOccupiedMoreMemoryThanAllowed;
            int    expectedFailureIndex     = 10;
            String occuredExceptionMessage  = null;
            int    i = 0;

            try {
                long limit = handler.GetMaxSizeOfDecompressedPdfStreamsSum();
                long step  = limit / 10;
                for (i = 0; i < 11; i++)
                {
                    handler.BeginDecompressedPdfStreamProcessing();
                    handler.ConsiderBytesOccupiedByDecompressedPdfStream(step);
                    handler.EndDecompressedPdfStreamProcessing();
                }
            }
            catch (MemoryLimitsAwareException e) {
                occuredExceptionMessage = e.Message;
            }
            NUnit.Framework.Assert.AreEqual(expectedFailureIndex, i);
            NUnit.Framework.Assert.AreEqual(expectedExceptionMessage, occuredExceptionMessage);
        }