public async Task CreateAnalyzeOperationConvenienceSetsOperationId() { var mockResponse = new MockResponse(202); mockResponse.AddHeader(new HttpHeader("Operation-Location", "something/jobs/2a96a91f-7edf-4931-a880-3fdee1d56f15")); var mockTransport = new MockTransport(new[] { mockResponse, mockResponse }); var client = CreateTestClient(mockTransport); var documents = new List <string> { "Elon Musk is the CEO of SpaceX and Tesla.", "Microsoft was founded by Bill Gates and Paul Allen.", "My cat and my dog might need to see a veterinarian." }; TextAnalyticsActions batchActions = new TextAnalyticsActions() { ExtractKeyPhrasesActions = new List <ExtractKeyPhrasesAction>() { new ExtractKeyPhrasesAction() }, }; AnalyzeActionsOperation operation = await client.StartAnalyzeActionsAsync(documents, batchActions); OperationContinuationToken continuationToken = OperationContinuationToken.Deserialize(operation.Id); Assert.IsNull(continuationToken.ShowStats); Assert.AreEqual("2a96a91f-7edf-4931-a880-3fdee1d56f15", continuationToken.JobId); Assert.AreEqual(3, continuationToken.InputDocumentOrder.Count); Assert.AreEqual(0, continuationToken.InputDocumentOrder["0"]); Assert.AreEqual(1, continuationToken.InputDocumentOrder["1"]); Assert.AreEqual(2, continuationToken.InputDocumentOrder["2"]); }
public async Task CreateHealthcareOperationSetsOperationId() { var mockResponse = new MockResponse(202); mockResponse.AddHeader(new HttpHeader("Operation-Location", "something/jobs/2a96a91f-7edf-4931-a880-3fdee1d56f15")); var mockTransport = new MockTransport(new[] { mockResponse, mockResponse }); var client = CreateTestClient(mockTransport); var documents = new List <TextDocumentInput> { new TextDocumentInput("134234", "Subject is taking 100mg of ibuprofen twice daily") { Language = "en", }, new TextDocumentInput("324232", "Can cause rapid or irregular heartbeat, delirium, panic, psychosis, and heart failure.") { Language = "en", } }; AnalyzeHealthcareEntitiesOperation operation = await client.StartAnalyzeHealthcareEntitiesAsync(documents); OperationContinuationToken continuationToken = OperationContinuationToken.Deserialize(operation.Id); Assert.IsFalse(continuationToken.ShowStats); Assert.AreEqual("2a96a91f-7edf-4931-a880-3fdee1d56f15", continuationToken.JobId); Assert.AreEqual(2, continuationToken.InputDocumentOrder.Count); Assert.AreEqual(0, continuationToken.InputDocumentOrder["134234"]); Assert.AreEqual(1, continuationToken.InputDocumentOrder["324232"]); }
public async Task CreateAnalyzeOperationSetsOperationId() { var mockResponse = new MockResponse(202); mockResponse.AddHeader(new HttpHeader("Operation-Location", "something/jobs/2a96a91f-7edf-4931-a880-3fdee1d56f15")); var mockTransport = new MockTransport(new[] { mockResponse, mockResponse }); var client = CreateTestClient(mockTransport); var documents = new List <TextDocumentInput> { new TextDocumentInput("134234", "Elon Musk is the CEO of SpaceX and Tesla.") { Language = "en", }, new TextDocumentInput("324232", "Tesla stock is up by 400% this year.") { Language = "en", } }; TextAnalyticsActions batchActions = new TextAnalyticsActions() { ExtractKeyPhrasesActions = new List <ExtractKeyPhrasesAction>() { new ExtractKeyPhrasesAction() }, }; AnalyzeActionsOperation operation = await client.StartAnalyzeActionsAsync(documents, batchActions); OperationContinuationToken continuationToken = OperationContinuationToken.Deserialize(operation.Id); Assert.IsNull(continuationToken.ShowStats); Assert.AreEqual("2a96a91f-7edf-4931-a880-3fdee1d56f15", continuationToken.JobId); Assert.AreEqual(2, continuationToken.InputDocumentOrder.Count); Assert.AreEqual(0, continuationToken.InputDocumentOrder["134234"]); Assert.AreEqual(1, continuationToken.InputDocumentOrder["324232"]); }