Exemple #1
0
        public void UnpackAsync_LZ77AESECB_Unpacked()
        {
            File.WriteAllBytes("packertest.txtczp", new byte[] { 0x02, 0x01, 0x10, 0x09, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x60 });
            var packer = new CompressionPacker();

            packer.Compressor = new LZ77();

            var task = packer.UnpackAsync("packertest.txtczp");

            task.Wait();

            byte[] result = File.ReadAllBytes("packertest.txt");
            CollectionAssert.AreEqual(new byte[] { 1, 2, 3 }, result);
        }
Exemple #2
0
        public void UnpackAsync_ProvidesEventMethods_EventsCalled()
        {
            File.WriteAllBytes("packertest.txtczp", new byte[] { 0x02, 0x01, 0x10, 0x09, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x60 });
            var packer = new CompressionPacker();

            packer.Compressor     = new LZ77();
            packer.StatusChanged += OnStatusChanged;
            _events.Clear();

            var task = packer.UnpackAsync("packertest.txtczp");

            task.Wait();

            Assert.IsTrue(_events[0].StartsWith("Decompressing"));
            Assert.IsTrue(_events[1].StartsWith("Finished"));
        }
Exemple #3
0
        public void PackAsync_ProvidesEventMethods_EventsCalled()
        {
            File.WriteAllBytes("packertest.txt", new byte[] { 1, 2, 3 });
            var packer = new CompressionPacker();

            packer.Compressor     = new LZ77();
            packer.StatusChanged += OnStatusChanged;
            _events.Clear();

            var task = packer.PackAsync("packertest.txt");

            task.Wait();

            Assert.IsTrue(_events[0].StartsWith("Compressing"));
            Assert.IsTrue(_events[1].StartsWith("Finished"));
        }