public async Task when_AddOrReplaceFileToTransaction_with_sha512_is_called_default_digest_is_sha512() { var mockHttp = new MockHttpMessageHandler(); mockHttp .Expect(HttpMethod.Put, "http://localhost/api/transaction/transaction Id/file/file Id") .WithHeaders("Digest", "SHA-512=z4PhNX7vuL3xVChQ1m2AB9Yg5AULVxXcg/SpIdNs6c5H0NE8XYXysP+DGNKHfuwvY7kxvUdBeoGlODJ6+SfaPg==") .Respond(HttpStatusCode.OK); using (var httpClient = mockHttp.ToHttpClient()) { var signhostApiClient = new SignHostApiClient(settings, httpClient); await signhostApiClient.AddOrReplaceFileToTransactionAsync( new MemoryStream(), "transaction Id", "file Id", new FileUploadOptions { DigestOptions = new FileDigestOptions { DigestHashAlgorithm = "SHA-512" } }); } mockHttp.VerifyNoOutstandingExpectation(); }
public async Task when_AddOrReplaceFileToTransaction_with_digest_value_is_used_as_is() { var mockHttp = new MockHttpMessageHandler(); mockHttp .Expect(HttpMethod.Put, "http://localhost/api/transaction/transaction Id/file/file Id") .WithHeaders("Digest", "SHA-1=AAEC") .Respond(HttpStatusCode.OK); using (var httpClient = mockHttp.ToHttpClient()) { var signhostApiClient = new SignHostApiClient(settings, httpClient); await signhostApiClient.AddOrReplaceFileToTransactionAsync( new MemoryStream(), "transaction Id", "file Id", new FileUploadOptions { DigestOptions = new FileDigestOptions { DigestHashAlgorithm = "SHA-1", DigestHashValue = new byte[] { 0x00, 0x01, 0x02 } } }); } mockHttp.VerifyNoOutstandingExpectation(); }
/// <inheritdoc /> public async Task AddOrReplaceFileToTransactionAsync( Stream fileStream, string transactionId, string fileId, FileUploadOptions uploadOptions, CancellationToken cancellationToken = default) { await retryPolicy .ExecuteAsync( ct => client.AddOrReplaceFileToTransactionAsync( fileStream, transactionId, fileId, uploadOptions, ct), cancellationToken); }