public void TestUsage()
        {
            MemoryUsage usage1 = new MemoryUsage(2048);

            Assert.That(!usage1.IsFull());
            Assert.That(usage1.Usage == 0);

            usage1.IncreaseUsage(1024);

            Assert.That(!usage1.IsFull());
            Assert.That(usage1.Usage == 1024);

            usage1.DecreaseUsage(512);

            Assert.That(!usage1.IsFull());
            Assert.That(usage1.Usage == 512);

            usage1.Usage = 2048;

            Assert.That(usage1.IsFull());
            Assert.That(usage1.Usage == 2048);

            usage1.IncreaseUsage(1024);
            Assert.That(usage1.IsFull());
            Assert.That(usage1.Usage == 3072);
        }
        public void TestWait()
        {
            MemoryUsage usage = new MemoryUsage(2048);

            usage.IncreaseUsage(5072);

            Thread thread1 = new Thread(delegate()
            {
                Thread.Sleep(100);
                usage.DecreaseUsage(usage.Usage);
            });

            thread1.Start();

            usage.WaitForSpace();
            Assert.That(usage.Usage == 0);

            thread1.Join();
        }