Exemplo n.º 1
0
        public async Task Gunzip_File_DeleteSource()
        {
            var        fileStore = _fileStoreFactory.GetFileStoreFromName("test");
            GZipWorker worker    = Host.Services.GetService <GZipWorker>();
            var        token     = await CreateGZipFileInStore(fileStore, "helloworld.txt.gz");

            var result = await worker.DoJsonWork <GZipInput, string>(new GZipInput
            {
                FileToken    = token,
                DeleteSource = true
            });

            Assert.Equal(Content, await ReadTextFileInStore(result));
            Assert.False(await fileStore.Exists(token));
        }
Exemplo n.º 2
0
        public async Task Simple_Gunzip_File(string fileName, string fileStoreName)
        {
            var fileStore = _fileStoreFactory.GetFileStoreFromName(fileStoreName);

            GZipWorker worker = Host.Services.GetService <GZipWorker>();
            var        token  = await CreateGZipFileInStore(fileStore, fileName);

            var result = await worker.DoJsonWork <GZipInput, string>(new GZipInput
            {
                FileToken = token,
            });

            Assert.Equal(Content, await ReadTextFileInStore(result));
            Assert.True(await fileStore.Exists(token));
        }
Exemplo n.º 3
0
        public async Task Compress_Set_Filename()
        {
            var        fileStore = _fileStoreFactory.GetFileStoreFromName("test");
            GZipWorker worker    = Host.Services.GetService <GZipWorker>();
            var        token     = await CreateFileInStore(fileStore, "helloworld.txt");

            var compressedFileToken = await worker.DoJsonWork <GZipInput, string>(new GZipInput
            {
                FileToken      = token,
                Compress       = true,
                OutputFileName = "hello.txt"
            });

            Assert.Equal("hello.txt", await fileStore.GetFileName(compressedFileToken));
        }
Exemplo n.º 4
0
        public async Task Simple_compress_File(string fileName)
        {
            var fileStore = _fileStoreFactory.GetFileStoreFromName("test");

            GZipWorker worker = Host.Services.GetService <GZipWorker>();
            var        token  = await CreateFileInStore(fileStore, fileName);

            var compressedFileToken = await worker.DoJsonWork <GZipInput, string>(new GZipInput
            {
                FileToken = token,
                Compress  = true
            });

            var outputFileToken = await UnzipFile("test", compressedFileToken);

            Assert.Equal(Content, await ReadTextFileInStore(outputFileToken));
            Assert.True(await fileStore.Exists(token));
        }
Exemplo n.º 5
0
        public async Task Compress_Delete_Source()
        {
            var fileStore = _fileStoreFactory.GetFileStoreFromName("test");

            GZipWorker worker = Host.Services.GetService <GZipWorker>();
            var        token  = await CreateFileInStore(fileStore, "helloworld.txt");

            var compressedFileToken = await worker.DoJsonWork <GZipInput, string>(new GZipInput
            {
                FileToken    = token,
                Compress     = true,
                DeleteSource = true
            });

            var outputFileToken = await UnzipFile("test", compressedFileToken);

            Assert.Equal(Content, await ReadTextFileInStore(outputFileToken));
            Assert.False(await fileStore.Exists(token));
        }