Skip to content

CLU Tests #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: CLU-FixingReadme
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Azure.AI.Language.Conversations.Models;
using NUnit.Framework;

namespace Azure.AI.Language.Conversations.Tests
{
public class ConversationAnalysisClientLiveTests : ConversationAnalysisTestBase<ConversationAnalysisClient>
Expand All @@ -9,5 +15,58 @@ public ConversationAnalysisClientLiveTests(bool isAsync, ConversationAnalysisCli
: base(isAsync, serviceVersion, null /* RecordedTestMode.Record /* to record */)
{
}
private static string EnglishText = "We'll have 2 plates of seared salmon nigiri.";
private static string SpanishText = "Tendremos 2 platos de nigiri de salmón braseado.";

[Test]
public async Task AnalyzeConversation()
{
ConversationAnalysisClient client = Client;

AnalyzeConversationOptions options = new AnalyzeConversationOptions(
TestEnvironment.ProjectName,
TestEnvironment.DeploymentName,
EnglishText);

Response<AnalyzeConversationResult> response = await client.AnalyzeConversationAsync(options);

Assert.That(response.Value.Prediction.TopIntent, Is.EqualTo("Order"));
}

[Test]
public async Task AnalyzeConversationWithLanguage()
{
ConversationAnalysisClient client = Client;

AnalyzeConversationOptions options = new AnalyzeConversationOptions(
TestEnvironment.ProjectName,
TestEnvironment.DeploymentName,
SpanishText)
{
Language = "es"
};

Response<AnalyzeConversationResult> response = await client.AnalyzeConversationAsync(options);

Assert.That(response.Value.Prediction.TopIntent, Is.EqualTo("Order"));
}

[Test]
public async Task AnalyzeConversationsDeepstack()
{
ConversationAnalysisClient client = Client;

AnalyzeConversationOptions options = new AnalyzeConversationOptions(
TestEnvironment.ProjectName,
TestEnvironment.DeploymentName,
EnglishText);

Response<AnalyzeConversationResult> response = await client.AnalyzeConversationAsync(options);

DeepstackPrediction deepstackPrediction = response.Value.Prediction as DeepstackPrediction;

Assert.That(deepstackPrediction.Entities, Is.Not.Null);
Assert.That(deepstackPrediction.TopIntent, Is.EqualTo("Order"));
}
}
}