Files
AI-Studio/app/Tests/Tools/CommonLanguagePromptTests.cs
T

35 lines
1.5 KiB
C#

using AIStudio.Tools;
namespace AIStudio.Tests.Tools;
/// <summary>
/// Checks how the prompts of the language assistants name the language the user chose.
/// </summary>
/// <remarks>
/// The Grammar &amp; Spelling Checker, the Rewrite &amp; Improve Text assistant, and the Translation assistant name the
/// language the same way, for a text as well as for a document. The name of a common language comes in the
/// language of the user interface, so its code follows it, and no choice leaves the prompt to name the language
/// of the text.
/// </remarks>
[TestFixture]
public sealed class CommonLanguagePromptTests
{
[Test]
public void NoChoiceNamesNoLanguage() => Assert.That(CommonLanguages.AS_IS.PromptLanguageName("Klingon"), Is.Null);
[Test]
public void ACustomLanguageIsNamedAsTheUserWroteIt() => Assert.That(CommonLanguages.OTHER.PromptLanguageName("Plattdüütsch"), Is.EqualTo("Plattdüütsch"));
[TestCase("")]
[TestCase(" ")]
public void AnEmptyCustomLanguageNamesNoLanguage(string customLanguage) => Assert.That(CommonLanguages.OTHER.PromptLanguageName(customLanguage), Is.Null);
[Test]
public void ACommonLanguageCarriesItsCode()
{
var name = CommonLanguages.DE_AT.PromptLanguageName(string.Empty);
Assert.That(name, Does.StartWith(CommonLanguages.DE_AT.Name));
Assert.That(name, Does.EndWith("(DE_AT)"), "The name follows the language of the user interface, so the code tells the model which language is meant.");
}
}