public async Task StartAnalyzeDocumentSendsContentType() { var mockResponse = new MockResponse(202); mockResponse.AddHeader(new HttpHeader(Constants.OperationLocationHeader, OperationId)); var mockTransport = new MockTransport(new[] { mockResponse, mockResponse }); var options = new DocumentAnalysisClientOptions() { Transport = mockTransport }; var client = CreateInstrumentedClient(options); using var stream = DocumentAnalysisTestEnvironment.CreateStream(TestFile.InvoiceLeTiff); await client.StartAnalyzeDocumentAsync(FakeGuid, stream); var request = mockTransport.Requests.Single(); Assert.True(request.Headers.TryGetValue("Content-Type", out var contentType)); Assert.AreEqual("application/octet-stream", contentType); }
public async Task StartAnalyzeDocumentSendsUserSpecifiedLocale(string locale) { var mockResponse = new MockResponse(202); mockResponse.AddHeader(new HttpHeader(Constants.OperationLocationHeader, OperationId)); var mockTransport = new MockTransport(new[] { mockResponse, mockResponse }); var options = new DocumentAnalysisClientOptions() { Transport = mockTransport }; var client = CreateInstrumentedClient(options); using var stream = DocumentAnalysisTestEnvironment.CreateStream(TestFile.ReceiptJpg); var analyzeOptions = new AnalyzeDocumentOptions { Locale = locale }; await client.StartAnalyzeDocumentAsync(FakeGuid, stream, analyzeOptions); var requestUriQuery = mockTransport.Requests.Single().Uri.Query; var expectedSubstring = $"locale={locale}"; Assert.True(requestUriQuery.Contains(expectedSubstring)); }