public WaivesClientFacts() { _requestSender = Substitute.For <IHttpRequestSender>(); _sut = new WaivesClient(_requestSender); _documentContents = new byte[] { 0, 1, 2 }; }
internal static async Task <IHttpDocumentFactory> CreateAsync( WaivesClient apiClient, bool deleteOrphanedDocuments = true, CancellationToken cancellationToken = default) { if (deleteOrphanedDocuments) { await DeleteOrphanedDocumentsAsync(apiClient, cancellationToken).ConfigureAwait(false); Logger.Info("Deleted all Waives documents"); } return(new LoggingDocumentFactory(new HttpDocumentFactory(apiClient))); }
private static async Task DeleteOrphanedDocumentsAsync(WaivesClient apiClient, CancellationToken cancellationToken = default) { var orphanedDocuments = await apiClient.GetAllDocumentsAsync(cancellationToken).ConfigureAwait(false); await Task.WhenAll(orphanedDocuments.Select(d => d.DeleteAsync(cancellationToken))).ConfigureAwait(false); }
private HttpDocumentFactory(WaivesClient apiClient) { _apiClient = apiClient; }
private static WaivesClient CreateAuthenticatedWaivesClient(WaivesOptions options) { var client = WaivesClient.Create(options.ApiUrl); return(client.Login(options.ClientId, options.ClientSecret)); }