Exemple #1
0
        public void TestCompression1()
        {
            var samples1_1000 = Sample1.GenerateSamples(100000);
            //TestSample1Sanity(1000, samples1_1000);

            Stopwatch w = new Stopwatch();

            w.Start();
            EnumerationFinder <Sample1> finder = new EnumerationFinder <Sample1>(samples1_1000);

            finder.GenerateEnumeration(x => x.Category);
            finder.GenerateEnumeration(x => x.CategoryId);
            finder.GenerateEnumeration(x => x.Manager);

            var packedData = DataCompressor <Sample1> .Compress(samples1_1000, finder.Schema, finder.EnumerationList);

            w.Stop();
            var elapsedMillis = w.Elapsed.TotalMilliseconds;

            var originalJson   = JsonUtils.ConvertToJson(samples1_1000).ToCharArray().Length;
            var compressedJson = JsonUtils.ConvertToJson(packedData).ToCharArray().Length;

            Assert.IsNotNull(packedData);
        }