Exemplo n.º 1
0
        public void uploadoptions_with_different_chunksize()
        {
            var opts = new UploadOptions
            {
                ChunkSizeBytes = 1024
            };

            var data = TestBytes.Generate(1024 * 2);

            var fileId = bucket.Upload(testfile, data, opts);

            fileId.Should().NotBeEmpty();

            var info = bucket.GetFileInfoByNameAsync(testfile, -1).WaitSync();

            info.ChunkSizeBytes.Should().Be(1024);

            //verify chunks
            var chunks = GridUtility.EnumerateChunks(bucket, info.Id).ToList();

            chunks.Count.Should().Be(2);

            foreach (var chunk in chunks)
            {
                chunk.Data.Length.Should().Be(1024);
            }
        }
Exemplo n.º 2
0
        public void uploadfile_with_no_bytes_should_have_no_chunks()
        {
            var fileId = bucket.Upload(testfile, TestBytes.NoChunks);

            var chunks = GridUtility.EnumerateChunks(bucket, fileId).ToList();

            chunks.Count.Should().Be(0);
        }
Exemplo n.º 3
0
        public void hard_delete_test()
        {
            CreateBucketWithOneFileTwoChunks();

            var file = bucket.GetFileInfoByName(testfile);

            //soft delete
            bucket.DeleteRevision(file.Id, mode: DeleteMode.Hard);

            var fileEntries = GridUtility.EnumerateFileEntries(bucket, testfile)
                              .ToList();

            fileEntries.Should().BeEmpty();


            var chunks = GridUtility.EnumerateChunks(bucket, file.Id)
                         .ToList();

            chunks.Should().BeEmpty();
        }