Example #1
0
        public async Task DetransformFileAsync_NotEncrypted_DataDecompressed()
        {
            const string Data = @"Hello. This is the input data. It is not encrypted.
Hello. This is the input data. It is not encrypted.
Hello. This is the input data. It is not encrypted.
Hello. This is the input data. It is not encrypted.
Hello. This is the input data. It is not encrypted.
Hello. This is the input data. It is not encrypted.
Hello. This is the input data. It is not encrypted.
Hello. This is the input data. It is not encrypted.
Hello. This is the input data. It is not encrypted.
Hello. This is the input data. It is not encrypted.
Hello. This is the input data. It is not encrypted.
Hello. This is the input data. It is not encrypted.
Hello. This is the input data. It is not encrypted.
Hello. This is the input data. It is not encrypted.
Hello. This is the input data. It is not encrypted.
Hello. This is the input data. It is not encrypted.
Hello. This is the input data. It is not encrypted.
Hello. This is the input data. It is not encrypted.
Hello. This is the input data. It is not encrypted.
Hello. This is the input data. It is not encrypted.
Hello. This is the input data. It is not encrypted.
Hello. This is the input data. It is not encrypted.";

            var sourceFilePath     = @"C:\source.txt";
            var compressedFilePath = @"C:\compressed.dat";
            var destFilePath       = @"C:\dest.txt";
            var chunkSize          = 0x10000U;
            var transform          = new NefsDataTransform(chunkSize, true);

            this.fileSystem.AddFile(sourceFilePath, new MockFileData(Data));

            // Compress the source data
            var transformer = new NefsTransformer(this.fileSystem);
            var size        = await transformer.TransformFileAsync(sourceFilePath, compressedFilePath, transform, new NefsProgress());

            // Decompress the data
            await transformer.DetransformFileAsync(compressedFilePath, 0, destFilePath, 0, (uint)Data.Length, size.Chunks, new NefsProgress());

            // Verify
            var decompressedText = this.fileSystem.File.ReadAllText(destFilePath);

            Assert.Equal(Data, decompressedText);
        }