public void GetCopressionRatioOfFileFilledWith_0_OfAround_200K_GZIP_Test()
        {
            int length         = 8 * 1024 * 200; //around 200k bits
            int max            = 1000;
            var dynamicAverage = new BlockingDoubleAverage();
            int count          = 0;

            Parallel.For(0, max, i =>
            {
                Interlocked.Increment(ref count);
                string fName = String.Concat(r.Next(), "tmp.bin");
                var bitArray = new BitArray(length, false);
                binaryFileWriter.Write(fName, FileMode.OpenOrCreate, bitArray.ToByteArray());
                double value = GzipStreamHelper.Compress(fName);
                dynamicAverage.Add(value);
                if (count % 100 == 0)
                {
                    Trace.WriteLine("Processed: " + count);
                }
                File.Delete(fName);
            });

            double result = dynamicAverage.GetCurrentAverage();

            Trace.WriteLine("Compressed: " + max + "files");
            Trace.WriteLine("Lenght of binary data: " + length);
            Trace.WriteLine("Average compression: " + result);
        }
        public double CalculateAveragedCompressionRate <T>(IEnumerable <T> data, int iterations, CompressionType type)
        {
            var average = new BlockingDoubleAverage();

            for (int i = 0; i < iterations; i++)
            {
                string fName = "temp.txt";
                double rate  = GetCompressionRate <T>(fName, data, type);
                average.Add(rate);
                File.Delete(fName);
            }

            return(average.GetCurrentAverage());
        }