public async Task CompressedBlob() { var createResult = await _session.EvaluateAsync("rtvs:::create_blob(raw(1000000))", REvaluationKind.Normal); createResult.Result.Should().NotBeNull(); var createCompressedResult = await _session.EvaluateAsync("rtvs:::create_compressed_blob(raw(1000000))", REvaluationKind.Normal); createCompressedResult.Result.Should().NotBeNull(); var blobId = ((JValue)createResult.Result).Value <ulong>(); var blobId2 = ((JValue)createCompressedResult.Result).Value <ulong>(); using (DataTransferSession dts = new DataTransferSession(_session, new FileSystem())) { var expectedData = await dts.FetchBytesAsync(new RBlobInfo(blobId), true, null, CancellationToken.None); var compressedData = await dts.FetchBytesAsync(new RBlobInfo(blobId2), true, null, CancellationToken.None); compressedData.Length.Should().BeLessThan(expectedData.Length); var actualData = await dts.FetchAndDecompressBytesAsync(new RBlobInfo(blobId2), true, null, CancellationToken.None); actualData.Should().Equal(expectedData); } }
public async Task CompressedZeroSizedBlob() { var createResult = await _session.EvaluateAsync("rtvs:::create_blob(raw())", REvaluationKind.Normal); createResult.Result.Should().NotBeNull(); var createCompressedResult = await _session.EvaluateAsync("rtvs:::create_compressed_blob(raw())", REvaluationKind.Normal); createCompressedResult.Result.Should().NotBeNull(); var blobId = ((JValue)createResult.Result).Value<ulong>(); var blobId2 = ((JValue)createCompressedResult.Result).Value<ulong>(); using (DataTransferSession dts = new DataTransferSession(_session, new FileSystem())) { var expectedData = await dts.FetchBytesAsync(new RBlobInfo(blobId), true, null, CancellationToken.None); var actualData = await dts.FetchAndDecompressBytesAsync(new RBlobInfo(blobId2), true, null, CancellationToken.None); actualData.Should().Equal(expectedData); } }