mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-04 19:47:22 +00:00
Upgraded to .NET 10 (#1147)
This commit is contained in:
1 parent
faae2951f7
commit
fc7399e81b
327 files changed
+3059
-3049
No files matched your search
@@ -54,11 +54,11 @@ public sealed class BatchProcessingResultFileFormatTests
|
||||
{
|
||||
var processed = await ProcessAsync("MICROSOFT_WORD");
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(processed, Is.True);
|
||||
Assert.That(this.ResultFileFormat, Is.EqualTo(FileExportFormat.MICROSOFT_WORD));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[TestCase("CSV", TestName = "A table, which holds one table out of an answer")]
|
||||
@@ -70,12 +70,12 @@ public sealed class BatchProcessingResultFileFormatTests
|
||||
var processed = await ProcessAsync(configuredFormat);
|
||||
|
||||
ManagedConfiguration.TryGet(x => x.BatchProcessing, x => x.ResultFileFormat, out var configMeta);
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(processed, Is.False, "The result files would end up without an extension or as something other than an answer.");
|
||||
Assert.That(this.ResultFileFormat, Is.EqualTo(FileExportFormat.HTML), "A rejected value leaves the choice of the user untouched.");
|
||||
Assert.That(configMeta.IsLocked, Is.False, "A rejected value locks nothing.");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private FileExportFormat ResultFileFormat
|
||||
|
||||
@@ -45,10 +45,10 @@ public sealed class ChatDataSourceDefaultsTests
|
||||
|
||||
var read = JsonSerializer.Deserialize<DataChat>(LEGACY_JSON, SettingsManager.JSON_OPTIONS)!;
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(read.PreselectedDataSourcesDisabled, Is.False, "The legacy nested object has to reach the individual fields, or this test checks nothing.");
|
||||
Assert.That(read.PreselectedDataSourcesRetrievalMode, Is.EqualTo(DataSourceRetrievalMode.SEMANTIC_SEARCH));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -42,7 +42,7 @@ public sealed class ChatTemplateConfigurationTests
|
||||
|
||||
var read = await ExportAndReadBackAsync(written);
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(read.ToolIds, Is.EquivalentTo(written.ToolIds!));
|
||||
Assert.That(read.DataSourceOptions, Is.Not.Null);
|
||||
@@ -51,7 +51,7 @@ public sealed class ChatTemplateConfigurationTests
|
||||
Assert.That(read.DataSourceOptions.AutomaticValidation, Is.True);
|
||||
Assert.That(read.DataSourceOptions.RetrievalMode, Is.EqualTo(DataSourceRetrievalMode.EVERY_MESSAGE), "Semantic search is the default, so only the other choice shows that the export carries it.");
|
||||
Assert.That(read.DataSourceOptions.PreselectedDataSourceIds, Is.EqualTo(written.DataSourceOptions!.PreselectedDataSourceIds));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -70,13 +70,13 @@ public sealed class ChatTemplateConfigurationTests
|
||||
|
||||
var read = await ExportAndReadBackAsync(written);
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(read.DataSourceOptions, Is.Not.Null);
|
||||
Assert.That(read.DataSourceOptions!.AutomaticDataSourceSelection, Is.True, "Letting an agent pick the sources is the one thing only a chat template can state, so it must not be lost on the way through Lua.");
|
||||
Assert.That(read.DataSourceOptions.PreselectedDataSourceIds, Is.Empty);
|
||||
Assert.That(read.ToolIds, Is.Null);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -85,22 +85,22 @@ public sealed class ChatTemplateConfigurationTests
|
||||
var written = NewTemplate();
|
||||
Assert.That(written.TryExportAsConfigurationSection(out var luaCode, out var issue), Is.True, issue);
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(luaCode, Does.Not.Contain("ToolIds"));
|
||||
Assert.That(luaCode, Does.Not.Contain("DataSourceOptions"));
|
||||
Assert.That(luaCode, Does.Not.Contain("ProviderId"));
|
||||
Assert.That(luaCode, Does.Not.Contain("ProfileId"));
|
||||
Assert.That(luaCode, Does.Not.Contain("WorkspaceName"));
|
||||
});
|
||||
}
|
||||
|
||||
var read = await ParseAsync(luaCode);
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(read.ToolIds, Is.Null, "A template without a tool selection must stay without one, so the chat keeps using its own default.");
|
||||
Assert.That(read.DataSourceOptions, Is.Null);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -130,14 +130,14 @@ public sealed class ChatTemplateConfigurationTests
|
||||
""");
|
||||
|
||||
Assert.That(read.DataSourceOptions, Is.Not.Null);
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(read.DataSourceOptions!.DisableDataSources, Is.False, "Writing this table is already the statement that the template wants data sources, so an omitted switch must not turn them off again.");
|
||||
Assert.That(read.DataSourceOptions.AutomaticDataSourceSelection, Is.False);
|
||||
Assert.That(read.DataSourceOptions.AutomaticValidation, Is.False);
|
||||
Assert.That(read.DataSourceOptions.RetrievalMode, Is.EqualTo(DataSourceRetrievalMode.SEMANTIC_SEARCH));
|
||||
Assert.That(read.DataSourceOptions.PreselectedDataSourceIds, Is.EqualTo(new[] { "11111111-1111-1111-1111-111111111111" }));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[TestCase("'EVERY_MESSAGE'", DataSourceRetrievalMode.EVERY_MESSAGE)]
|
||||
@@ -186,11 +186,11 @@ public sealed class ChatTemplateConfigurationTests
|
||||
}
|
||||
""");
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(read.ToolIds, Is.EquivalentTo(new[] { "web_search", "read_web_page" }));
|
||||
Assert.That(read.DataSourceOptions!.PreselectedDataSourceIds, Is.EqualTo(new[] { "11111111-1111-1111-1111-111111111111" }));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -204,11 +204,11 @@ public sealed class ChatTemplateConfigurationTests
|
||||
|
||||
var read = await ExportAndReadBackAsync(written);
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(read.ProviderId, Is.EqualTo(written.ProviderId));
|
||||
Assert.That(read.ProfileId, Is.EqualTo(written.ProfileId));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -217,12 +217,12 @@ public sealed class ChatTemplateConfigurationTests
|
||||
var read = await ExportAndReadBackAsync(NewTemplate() with { ProfileId = Profile.NO_PROFILE.Id });
|
||||
var silent = await ExportAndReadBackAsync(NewTemplate());
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(read.ProfileId, Is.EqualTo(Profile.NO_PROFILE.Id), "Reading this back as null would hand out the default profile the template ruled out.");
|
||||
Assert.That(silent.ProfileId, Is.Null);
|
||||
Assert.That(silent.ProviderId, Is.Null);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -239,11 +239,11 @@ public sealed class ChatTemplateConfigurationTests
|
||||
}
|
||||
""");
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(read.ProviderId, Is.EqualTo("44444444-4444-4444-4444-444444444444"));
|
||||
Assert.That(read.ProfileId, Is.EqualTo("55555555-5555-5555-5555-555555555555"));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[TestCase("\"\"")]
|
||||
@@ -271,11 +271,11 @@ public sealed class ChatTemplateConfigurationTests
|
||||
var read = await ExportAndReadBackAsync(written);
|
||||
var silent = await ExportAndReadBackAsync(NewTemplate());
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(read.WorkspaceName, Is.EqualTo(written.WorkspaceName));
|
||||
Assert.That(silent.WorkspaceName, Is.Null, "A template without a workspace must keep leaving the chat where it would go anyway.");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[TestCase("\"\"")]
|
||||
@@ -320,11 +320,11 @@ public sealed class ChatTemplateConfigurationTests
|
||||
Assert.That(withProvider.TryExportAsConfigurationSection(out var withProviderLua, out var issue), Is.True, issue);
|
||||
Assert.That(withoutProfile.TryExportAsConfigurationSection(out var withoutProfileLua, out issue), Is.True, issue);
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(withProviderLua, Does.StartWith("--"), "A provider of this machine is mostly the user's own, which no configuration plugin knows.");
|
||||
Assert.That(withoutProfileLua, Does.Not.StartWith("--"), "Starting without a profile names nothing which could be missing.");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -343,11 +343,11 @@ public sealed class ChatTemplateConfigurationTests
|
||||
Assert.That(withSources.TryExportAsConfigurationSection(out var withSourcesLua, out var issue), Is.True, issue);
|
||||
Assert.That(agenticOnly.TryExportAsConfigurationSection(out var agenticOnlyLua, out issue), Is.True, issue);
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(withSourcesLua, Does.StartWith("--"), "Whoever pastes this into a plugin cannot see from the IDs alone that they belong to another machine.");
|
||||
Assert.That(agenticOnlyLua, Does.Not.StartWith("--"), "Without IDs there is nothing to check, so the note would only be noise.");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -380,12 +380,12 @@ public sealed class ChatTemplateConfigurationTests
|
||||
DataSourceOptions = new() { DisableDataSources = false, AutomaticDataSourceSelection = true },
|
||||
};
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(ChatTemplate.GetPreselectedLocalDataSourceNames(eriOnly, ConfiguredDataSources()), Is.Empty);
|
||||
Assert.That(ChatTemplate.GetPreselectedLocalDataSourceNames(agentic, ConfiguredDataSources()), Is.Empty, "An agent picks the sources per message, so this template names none to begin with.");
|
||||
Assert.That(ChatTemplate.GetPreselectedLocalDataSourceNames(NewTemplate(), ConfiguredDataSources()), Is.Empty);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -41,12 +41,12 @@ public sealed class ChatTemplateLauncherSelectionTests : ToolRegistryTestBase
|
||||
var providerResult = service.ResolveProvider(PLUGIN_NAME, template, LAUNCHER_PROVIDER_ID);
|
||||
var profileResult = service.ResolveProfile(PLUGIN_NAME, template, LAUNCHER_PROFILE_ID);
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(providerResult.Provider, Is.EqualTo(templateProvider));
|
||||
Assert.That(providerResult.IsExplicit, Is.True);
|
||||
Assert.That(profileResult.Profile, Is.EqualTo(templateProfile));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -61,13 +61,13 @@ public sealed class ChatTemplateLauncherSelectionTests : ToolRegistryTestBase
|
||||
var providerResult = service.ResolveProvider(PLUGIN_NAME, template, LAUNCHER_PROVIDER_ID);
|
||||
var profileResult = service.ResolveProfile(PLUGIN_NAME, template, LAUNCHER_PROFILE_ID);
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(providerResult.Provider, Is.EqualTo(launcherProvider));
|
||||
Assert.That(providerResult.ErrorMessage, Is.Empty);
|
||||
Assert.That(profileResult.Profile, Is.EqualTo(launcherProfile));
|
||||
Assert.That(profileResult.ErrorMessage, Is.Empty);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -81,12 +81,12 @@ public sealed class ChatTemplateLauncherSelectionTests : ToolRegistryTestBase
|
||||
var template = NewTemplate() with { ProviderId = templateProvider.Id };
|
||||
var providerResult = this.CreateService().ResolveProvider(PLUGIN_NAME, template, null);
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(providerResult.Provider, Is.Not.EqualTo(templateProvider), "A template must not open the way to a provider the user could not pick by hand.");
|
||||
Assert.That(providerResult.IsExplicit, Is.False, "The launcher names no provider, so the chat starts with its defaults instead of failing.");
|
||||
Assert.That(providerResult.ErrorMessage, Is.Empty);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -107,11 +107,11 @@ public sealed class ChatTemplateLauncherSelectionTests : ToolRegistryTestBase
|
||||
var options = new DataSourceOptions { DisableDataSources = false, PreselectedDataSourceIds = ["99999999-9999-9999-9999-999999999999"] };
|
||||
var result = await this.CreateService().CheckChosenDataSourcesAsync(ToolCapableProvider(), options, originChatTemplate: null);
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(result.Options, Is.SameAs(options), "The chat uses no data sources without RAG, so the options travel along unchecked and count once RAG is back.");
|
||||
Assert.That(result.ErrorMessage, Is.Empty);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -121,11 +121,11 @@ public sealed class ChatTemplateLauncherSelectionTests : ToolRegistryTestBase
|
||||
var options = new DataSourceOptions { DisableDataSources = false, PreselectedDataSourceIds = ["99999999-9999-9999-9999-999999999999"] };
|
||||
var result = await this.CreateService().CheckChosenDataSourcesAsync(ToolCapableProvider(), options, originChatTemplate: null);
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(result.Options, Is.Null, "Opening a launcher is one click, so a missing source has to be said out loud.");
|
||||
Assert.That(result.ErrorMessage, Is.Not.Empty);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Data sources are not resolved by these tests beyond their lookup, so the service needs no data source service:
|
||||
|
||||
@@ -22,11 +22,11 @@ public sealed class ChatTemplatePrecedenceTests
|
||||
var toolChoice = ChatTemplate.ChooseToolIds(NewTemplate(), null);
|
||||
var optionsChoice = ChatTemplate.ChooseDataSourceOptions(NewTemplate(), null);
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(toolChoice, Is.EqualTo(ChatTemplateToolChoice.NONE), "Nobody named any tool, so the chat has to keep using the tools of its own default.");
|
||||
Assert.That(optionsChoice, Is.EqualTo(ChatTemplateDataSourceChoice.NONE), "Nobody named any data source, so the chat has to keep using its own default options.");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -38,13 +38,13 @@ public sealed class ChatTemplatePrecedenceTests
|
||||
var toolChoice = ChatTemplate.ChooseToolIds(template, new[] { "web_search" });
|
||||
var optionsChoice = ChatTemplate.ChooseDataSourceOptions(template, launcherOptions);
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(toolChoice.ToolIds, Is.EquivalentTo(new[] { "web_search" }));
|
||||
Assert.That(toolChoice.LauncherChoiceDropped, Is.False, "Nothing was dropped here, so nothing may be reported as dropped either.");
|
||||
Assert.That(optionsChoice.Options, Is.SameAs(launcherOptions));
|
||||
Assert.That(optionsChoice.LauncherChoiceDropped, Is.False);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -59,13 +59,13 @@ public sealed class ChatTemplatePrecedenceTests
|
||||
var toolChoice = ChatTemplate.ChooseToolIds(template, null);
|
||||
var optionsChoice = ChatTemplate.ChooseDataSourceOptions(template, null);
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(toolChoice.ToolIds, Is.EquivalentTo(new[] { "read_web_page" }));
|
||||
Assert.That(toolChoice.LauncherChoiceDropped, Is.False);
|
||||
Assert.That(optionsChoice.Options!.PreselectedDataSourceIds, Is.EqualTo(new[] { "22222222-2222-2222-2222-222222222222" }));
|
||||
Assert.That(optionsChoice.LauncherChoiceDropped, Is.False);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -80,13 +80,13 @@ public sealed class ChatTemplatePrecedenceTests
|
||||
var toolChoice = ChatTemplate.ChooseToolIds(template, new[] { "web_search" });
|
||||
var optionsChoice = ChatTemplate.ChooseDataSourceOptions(template, NewLauncherOptions("11111111-1111-1111-1111-111111111111"));
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(toolChoice.ToolIds, Is.EquivalentTo(new[] { "read_web_page" }));
|
||||
Assert.That(toolChoice.LauncherChoiceDropped, Is.True, "The tools of the launcher are gone, and only this flag can make the log say so.");
|
||||
Assert.That(optionsChoice.Options!.PreselectedDataSourceIds, Is.EqualTo(new[] { "22222222-2222-2222-2222-222222222222" }));
|
||||
Assert.That(optionsChoice.LauncherChoiceDropped, Is.True);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -96,11 +96,11 @@ public sealed class ChatTemplatePrecedenceTests
|
||||
|
||||
var toolChoice = ChatTemplate.ChooseToolIds(template, new[] { "web_search" });
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(toolChoice.ToolIds, Is.Empty, "An empty selection is the statement that this template wants no tools, which is as much of a statement as naming one.");
|
||||
Assert.That(toolChoice.LauncherChoiceDropped, Is.True);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -113,12 +113,12 @@ public sealed class ChatTemplatePrecedenceTests
|
||||
|
||||
var optionsChoice = ChatTemplate.ChooseDataSourceOptions(template, NewLauncherOptions("11111111-1111-1111-1111-111111111111"));
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(optionsChoice.Options!.AutomaticDataSourceSelection, Is.True, "Letting an agent pick the sources is the one thing a launcher cannot express, so it is exactly what must not be overwritten by one.");
|
||||
Assert.That(optionsChoice.Options.PreselectedDataSourceIds, Is.Empty);
|
||||
Assert.That(optionsChoice.LauncherChoiceDropped, Is.True);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -28,11 +28,11 @@ public sealed class ChatTemplateStartSelectionTests : ToolRegistryTestBase
|
||||
this.AddProfile();
|
||||
this.SettingsManager.ConfigurationData.Providers.Add(ToolCapableProvider());
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(this.SettingsManager.GetChatTemplateProfile(NewTemplate()), Is.Null);
|
||||
Assert.That(this.SettingsManager.GetChatTemplateProvider(NewTemplate()), Is.EqualTo(AIStudio.Settings.Provider.NONE));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -43,11 +43,11 @@ public sealed class ChatTemplateStartSelectionTests : ToolRegistryTestBase
|
||||
this.SettingsManager.ConfigurationData.Providers.Add(provider);
|
||||
var template = NewTemplate() with { ProfileId = PROFILE_ID, ProviderId = provider.Id };
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(this.SettingsManager.GetChatTemplateProfile(template), Is.EqualTo(profile));
|
||||
Assert.That(this.SettingsManager.GetChatTemplateProvider(template), Is.EqualTo(provider));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -63,11 +63,11 @@ public sealed class ChatTemplateStartSelectionTests : ToolRegistryTestBase
|
||||
{
|
||||
var template = NewTemplate() with { ProfileId = PROFILE_ID, ProviderId = "66666666-6666-6666-6666-666666666666" };
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(this.SettingsManager.GetChatTemplateProfile(template), Is.Null);
|
||||
Assert.That(this.SettingsManager.GetChatTemplateProvider(template), Is.EqualTo(AIStudio.Settings.Provider.NONE));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -83,11 +83,11 @@ public sealed class ChatTemplateStartSelectionTests : ToolRegistryTestBase
|
||||
this.SettingsManager.ConfigurationData.Chat.PreselectedProfile = defaultProfile.Id;
|
||||
var withDefault = this.SettingsManager.GetChatTemplateStartProfile(template);
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(withoutDefault, Is.EqualTo(Profile.NO_PROFILE), "Keeping the profile the chat had would hand out one the previous chat happened to use, a choice nobody made for this one.");
|
||||
Assert.That(withDefault, Is.EqualTo(defaultProfile));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -95,12 +95,12 @@ public sealed class ChatTemplateStartSelectionTests : ToolRegistryTestBase
|
||||
{
|
||||
this.AddProfile();
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(this.SettingsManager.GetChatTemplateStartProfile(NewTemplate()), Is.Null);
|
||||
Assert.That(this.SettingsManager.GetChatTemplateStartProfile(NewTemplate() with { AllowProfileUsage = false, ProfileId = PROFILE_ID }), Is.Null);
|
||||
Assert.That(this.SettingsManager.GetChatTemplateStartProfile(NewTemplate() with { ProfileId = PROFILE_ID })!.Id, Is.EqualTo(PROFILE_ID));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -135,13 +135,13 @@ public sealed class ChatTemplateStartSelectionTests : ToolRegistryTestBase
|
||||
this.SettingsManager.ConfigurationData.Confidence.EnforceGlobalMinimumConfidence = true;
|
||||
this.SettingsManager.ConfigurationData.Confidence.GlobalMinimumConfidence = ConfidenceLevel.HIGH;
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(this.SettingsManager.GetChatTemplateProvider(trustedProvider.Id), Is.EqualTo(trustedProvider));
|
||||
Assert.That(this.SettingsManager.GetChatTemplateProvider(lessTrustedProvider.Id), Is.EqualTo(AIStudio.Settings.Provider.NONE), "The chat template dialog and the import warn about exactly the providers a chat leaves out.");
|
||||
Assert.That(this.SettingsManager.GetChatTemplateProvider("66666666-6666-6666-6666-666666666666"), Is.EqualTo(AIStudio.Settings.Provider.NONE));
|
||||
Assert.That(this.SettingsManager.GetChatTemplateProvider((string?)null), Is.EqualTo(AIStudio.Settings.Provider.NONE));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -155,12 +155,12 @@ public sealed class ChatTemplateStartSelectionTests : ToolRegistryTestBase
|
||||
this.SettingsManager.ConfigurationData.Workspace.StorageBehavior = WorkspaceStorageBehavior.DISABLE_WORKSPACES;
|
||||
var whileSwitchedOff = this.SettingsManager.GetChatTemplateWorkspaceName(template);
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(whileUsed, Is.EqualTo("Mails"));
|
||||
Assert.That(whileSwitchedOff, Is.Null, "Without workspaces, a template must not bring one back for its chats.");
|
||||
Assert.That(this.SettingsManager.GetChatTemplateWorkspaceName(NewTemplate()), Is.Null);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -177,11 +177,11 @@ public sealed class ChatTemplateStartSelectionTests : ToolRegistryTestBase
|
||||
var previousTemplate = NewTemplate() with { ProfileId = PROFILE_ID, ProviderId = templateProvider.Id };
|
||||
var nextTemplate = NewTemplate() with { Id = OTHER_TEMPLATE_ID };
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(this.SettingsManager.ChooseChatTemplateProfile(nextTemplate, previousTemplate, templateProfile), Is.EqualTo(defaultProfile), "The profile was the choice of another template, not one made for this chat.");
|
||||
Assert.That(this.SettingsManager.ChooseChatTemplateProvider(nextTemplate, previousTemplate, templateProvider), Is.EqualTo(defaultProvider), "The provider was the choice of another template, not one made for this chat.");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -197,12 +197,12 @@ public sealed class ChatTemplateStartSelectionTests : ToolRegistryTestBase
|
||||
var previousTemplate = NewTemplate() with { ProfileId = defaultProfile.Id, ProviderId = templateProvider.Id };
|
||||
var nextTemplate = NewTemplate() with { Id = OTHER_TEMPLATE_ID };
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(this.SettingsManager.ChooseChatTemplateProfile(nextTemplate, previousTemplate, handPickedProfile), Is.EqualTo(handPickedProfile));
|
||||
Assert.That(this.SettingsManager.ChooseChatTemplateProvider(nextTemplate, previousTemplate, handPickedProvider), Is.EqualTo(handPickedProvider));
|
||||
Assert.That(this.SettingsManager.ChooseChatTemplateProfile(NewTemplate(), NewTemplate(), handPickedProfile), Is.EqualTo(handPickedProfile), "Without any preselection, nothing changes.");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -218,11 +218,11 @@ public sealed class ChatTemplateStartSelectionTests : ToolRegistryTestBase
|
||||
var previousTemplate = NewTemplate() with { Id = OTHER_TEMPLATE_ID, ProfileId = otherProfile.Id, ProviderId = otherProvider.Id };
|
||||
var nextTemplate = NewTemplate() with { ProfileId = PROFILE_ID, ProviderId = templateProvider.Id };
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(this.SettingsManager.ChooseChatTemplateProfile(nextTemplate, previousTemplate, otherProfile), Is.EqualTo(templateProfile));
|
||||
Assert.That(this.SettingsManager.ChooseChatTemplateProvider(nextTemplate, previousTemplate, otherProvider), Is.EqualTo(templateProvider));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -37,11 +37,11 @@ public sealed class DataAppImportPermissionTests
|
||||
var app = new DataApp();
|
||||
SwitchOff(app, type);
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
foreach (var other in IMPORTABLE_TYPES)
|
||||
Assert.That(app.CanImportConfigurationSnippet(other), Is.EqualTo(other != type), $"Switched off: {type}, checked: {other}");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[TestCase(PluginConfigurationObjectType.LLM_PROVIDER)]
|
||||
@@ -57,11 +57,11 @@ public sealed class DataAppImportPermissionTests
|
||||
AllowUserToAddTranscriptionProvider = type is not PluginConfigurationObjectType.TRANSCRIPTION_PROVIDER,
|
||||
};
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(withoutAnyProvider.CanImportConfigurationSnippet(type), Is.False, "No provider may be added at all.");
|
||||
Assert.That(withoutThisProvider.CanImportConfigurationSnippet(type), Is.False, "This type of provider may not be added.");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -75,13 +75,13 @@ public sealed class DataAppImportPermissionTests
|
||||
AllowUserToAddTranscriptionProvider = false,
|
||||
};
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(app.CanImportConfigurationSnippet(PluginConfigurationObjectType.PROFILE), Is.True);
|
||||
Assert.That(app.CanImportConfigurationSnippet(PluginConfigurationObjectType.CHAT_TEMPLATE), Is.True);
|
||||
Assert.That(app.CanImportConfigurationSnippet(PluginConfigurationObjectType.DATA_SOURCE), Is.True);
|
||||
Assert.That(app.CanImportConfigurationSnippet(PluginConfigurationObjectType.DOCUMENT_ANALYSIS_POLICY), Is.True);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[TestCase(PluginConfigurationObjectType.NONE)]
|
||||
|
||||
@@ -65,12 +65,12 @@ public sealed class DataSourceERICancellationTests
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ACancelledSearchStops()
|
||||
public async Task ACancelledSearchStops()
|
||||
{
|
||||
using var cancellation = new CancellationTokenSource();
|
||||
cancellation.Cancel();
|
||||
|
||||
Assert.CatchAsync<OperationCanceledException>(async () => await UNREACHABLE.RetrieveDataAsync("query", 1, new ChatThread(), cancellation.Token), "Reporting the data source as not searched would carry on after the user cancelled.");
|
||||
await Assert.CatchAsync<OperationCanceledException>(async () => await UNREACHABLE.RetrieveDataAsync("query", 1, new ChatThread(), cancellation.Token), "Reporting the data source as not searched would carry on after the user cancelled.");
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -78,10 +78,10 @@ public sealed class DataSourceERICancellationTests
|
||||
{
|
||||
var page = await UNREACHABLE.RetrieveDataAsync("query", 1, new ChatThread());
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(page.Contexts, Is.Empty);
|
||||
Assert.That(page.Gaps, Is.EqualTo(new[] { RetrievalGap.NOT_SEARCHED }), "Nobody cancelled, so the model learns that this data source is missing rather than empty.");
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -53,12 +53,12 @@ public sealed class DataSourceOutboundDataRestrictionTests
|
||||
[Test]
|
||||
public void ANewDataSourceAllowsOnlyLinksFromTheChat()
|
||||
{
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(new DataSourceLocalFile().OutboundDataRestriction, Is.EqualTo(OutboundDataRestriction.ONLY_LINKS_FROM_CHAT));
|
||||
Assert.That(new DataSourceLocalDirectory().OutboundDataRestriction, Is.EqualTo(OutboundDataRestriction.ONLY_LINKS_FROM_CHAT));
|
||||
Assert.That(new DataSourceERI_V1().OutboundDataRestriction, Is.EqualTo(OutboundDataRestriction.ONLY_LINKS_FROM_CHAT));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[TestCase(nameof(DataSourceType.LOCAL_FILE))]
|
||||
@@ -101,11 +101,11 @@ public sealed class DataSourceOutboundDataRestrictionTests
|
||||
[Test]
|
||||
public void WithoutAnOrganizationTheUserDecides()
|
||||
{
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(new DataSourceSecuritySettings().MinimumOutboundDataRestriction, Is.EqualTo(OutboundDataRestriction.UNRESTRICTED));
|
||||
Assert.That(OPEN_FOLDER.GetEffectiveOutboundDataRestriction(OutboundDataRestriction.UNRESTRICTED), Is.EqualTo(OutboundDataRestriction.UNRESTRICTED));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -119,11 +119,11 @@ public sealed class DataSourceOutboundDataRestrictionTests
|
||||
[Test]
|
||||
public void ADataSourceForSelfHostedProvidersAllowsOnlyTheConfiguredServices()
|
||||
{
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(SELF_HOSTED_SERVER.GetEffectiveOutboundDataRestriction(OutboundDataRestriction.UNRESTRICTED), Is.EqualTo(OutboundDataRestriction.ONLY_CONFIGURED_SERVICES), "Stored before, or provided by a configuration plugin, its level never went through the dialog.");
|
||||
Assert.That(OPEN_SERVER.GetEffectiveOutboundDataRestriction(OutboundDataRestriction.UNRESTRICTED), Is.EqualTo(OutboundDataRestriction.UNRESTRICTED));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[TestCase(DataSourceSecurity.NOT_SPECIFIED, OutboundDataRestriction.UNRESTRICTED, OutboundDataRestriction.UNRESTRICTED)]
|
||||
|
||||
@@ -69,11 +69,11 @@ public sealed class EnterpriseEncryptionExportFormatTests
|
||||
var settingsManager = CreateSettingsManager();
|
||||
await settingsManager.LoadSettings();
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(File.Exists(this.SettingsPath), Is.False, "A new installation has no settings file yet.");
|
||||
Assert.That(settingsManager.ConfigurationData.App.EnterpriseEncryptionExportFormat, Is.EqualTo(EnterpriseEncryptionFormat.V2));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -87,11 +87,11 @@ public sealed class EnterpriseEncryptionExportFormatTests
|
||||
await settingsManager.LoadSettings();
|
||||
await settingsManager.StoreSettings();
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(settingsManager.ConfigurationData.App.EnterpriseEncryptionExportFormat, Is.EqualTo(EnterpriseEncryptionFormat.V1));
|
||||
Assert.That(this.ReadStoredFormat(), Is.EqualTo(nameof(EnterpriseEncryptionFormat.V1)), "Once stored, the settings hold the format, and the shim has nothing left to do.");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -35,11 +35,11 @@ public sealed class EnumNamesTests
|
||||
[Test]
|
||||
public void SeveralNamesDoNotCount()
|
||||
{
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(EnumNames.TryParse<DataSourceRetrievalMode>("SEMANTIC_SEARCH, EVERY_MESSAGE", out _), Is.False, "Enum.TryParse would combine them to EVERY_MESSAGE.");
|
||||
Assert.That(EnumNames.TryParse<ConfidenceLevel>("HIGH, MEDIUM", out _), Is.False, "Enum.TryParse would combine them to a confidence level above HIGH.");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[TestCase(null)]
|
||||
|
||||
@@ -36,11 +36,11 @@ public sealed class InterfaceScreenSizesTests
|
||||
app.RememberInterfaceScreenSize(new(MONITOR, InterfaceSize.SYSTEM_SCALING, null));
|
||||
app.RememberInterfaceScreenSize(new(LAPTOP, InterfaceSize.SYSTEM_SCALING, 120));
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(app.InterfaceScreenSizes.Select(screen => screen.ScreenKey), Is.EqualTo(new[] { LAPTOP, MONITOR }));
|
||||
Assert.That(app.GetInterfaceScreenSize(LAPTOP), Is.EqualTo(new InterfaceScreenSize(LAPTOP, InterfaceSize.SYSTEM_SCALING, 120)));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -50,11 +50,11 @@ public sealed class InterfaceScreenSizesTests
|
||||
for (var screen = 0; screen <= DataApp.MAX_REMEMBERED_INTERFACE_SCREENS; screen++)
|
||||
app.RememberInterfaceScreenSize(new($"{screen}x1080", InterfaceSize.CUSTOM, 100));
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(app.InterfaceScreenSizes, Has.Count.EqualTo(DataApp.MAX_REMEMBERED_INTERFACE_SCREENS));
|
||||
Assert.That(app.GetInterfaceScreenSize("0x1080"), Is.Null);
|
||||
Assert.That(app.GetInterfaceScreenSize("1x1080"), Is.Not.Null);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -63,12 +63,12 @@ public sealed class MailboxOutboundDataRestrictionTests
|
||||
[Test]
|
||||
public void TheDialogOffersOnlyTheLevelsAllowed()
|
||||
{
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(GetOfferedLevels(OutboundDataRestriction.UNRESTRICTED), Is.EqualTo(new[] { OutboundDataRestriction.ONLY_CONFIGURED_SERVICES, OutboundDataRestriction.ONLY_LINKS_FROM_CHAT, OutboundDataRestriction.UNRESTRICTED }));
|
||||
Assert.That(GetOfferedLevels(OutboundDataRestriction.ONLY_LINKS_FROM_CHAT), Is.EqualTo(new[] { OutboundDataRestriction.ONLY_CONFIGURED_SERVICES, OutboundDataRestriction.ONLY_LINKS_FROM_CHAT }));
|
||||
Assert.That(GetOfferedLevels(OutboundDataRestriction.ONLY_CONFIGURED_SERVICES), Is.EqualTo(new[] { OutboundDataRestriction.ONLY_CONFIGURED_SERVICES }));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private static IEnumerable<OutboundDataRestriction> GetOfferedLevels(OutboundDataRestriction minimumRestriction) => ConfigurationSelectDataFactory.GetOutboundDataRestrictionData(minimumRestriction).Select(option => option.Value);
|
||||
|
||||
@@ -42,7 +42,7 @@ public sealed class MailboxProviderConfigurationTests
|
||||
});
|
||||
|
||||
Assert.That(provider, Is.Not.Null);
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(provider!.Id, Is.EqualTo(ID));
|
||||
Assert.That(provider.EnterpriseConfigurationPluginId, Is.EqualTo(PLUGIN_ID));
|
||||
@@ -52,7 +52,7 @@ public sealed class MailboxProviderConfigurationTests
|
||||
Assert.That(provider.Port, Is.EqualTo(1143));
|
||||
Assert.That(provider.UsernameHint, Is.EqualTo(@"Your account as DOMAIN\username"));
|
||||
Assert.That(provider.HelpUrl, Is.EqualTo("https://intranet.example.org/mail/imap"));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -61,14 +61,14 @@ public sealed class MailboxProviderConfigurationTests
|
||||
var withoutEncryption = await ReadAsync(new Dictionary<string, string?>());
|
||||
var withStartTls = await ReadAsync(new Dictionary<string, string?> { ["TransportSecurity"] = "\"STARTTLS\"" });
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(withoutEncryption?.TransportSecurity, Is.EqualTo(MailboxTransportSecurity.SSL_ON_CONNECT), "TLS from the first byte on is the safer of the two ways.");
|
||||
Assert.That(withoutEncryption?.Port, Is.EqualTo(993));
|
||||
Assert.That(withStartTls?.Port, Is.EqualTo(143));
|
||||
Assert.That(withoutEncryption?.UsernameHint, Is.Empty);
|
||||
Assert.That(withoutEncryption?.HelpUrl, Is.Empty);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -105,12 +105,12 @@ public sealed class MailboxSettingsTests
|
||||
var settingsManager = CreateSettingsManager();
|
||||
var loaded = await settingsManager.TryReadSettingsSnapshot();
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(settingsManager.SettingsWriteBlockReason, Is.EqualTo(SettingsWriteBlockReason.NONE), "The mailboxes kept the settings from being written.");
|
||||
Assert.That(loaded?.Version, Is.EqualTo(stored.Version), "The settings were loaded as another version.");
|
||||
Assert.That(loaded?.Mailboxes, Is.EqualTo(new[] { MAILBOX }), "The mailboxes were lost while loading.");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -122,11 +122,11 @@ public sealed class MailboxSettingsTests
|
||||
var settingsManager = CreateSettingsManager();
|
||||
var loaded = await settingsManager.TryReadSettingsSnapshot();
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(settingsManager.SettingsWriteBlockReason, Is.EqualTo(SettingsWriteBlockReason.NONE), "The settings without mailboxes were blocked from being written.");
|
||||
Assert.That(loaded?.Mailboxes, Is.Empty, "Mailboxes appeared out of nowhere.");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -157,14 +157,14 @@ public sealed class MailboxSettingsTests
|
||||
""";
|
||||
|
||||
var mailbox = JsonSerializer.Deserialize<DataSourceMailbox>(JSON, SettingsManager.JSON_OPTIONS);
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(mailbox.ConfidenceLevel, Is.EqualTo(ConfidenceLevel.NONE));
|
||||
Assert.That(mailbox.TransportSecurity, Is.EqualTo(MailboxTransportSecurity.UNKNOWN));
|
||||
Assert.That(mailbox.AuthMethod, Is.EqualTo(MailboxAuthMethod.UNKNOWN));
|
||||
Assert.That(mailbox.MaxAge, Is.EqualTo(MailboxMaxAge.LAST_3_MONTHS));
|
||||
Assert.That(mailbox.OutboundDataRestriction, Is.EqualTo(OutboundDataRestriction.ONLY_CONFIGURED_SERVICES));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks>
|
||||
|
||||
@@ -67,13 +67,13 @@ public sealed class ManagedGuidSettingTests
|
||||
var processed = await ProcessAsync(settingName, configuredText, allowUserOverride: false);
|
||||
|
||||
var configMeta = GetMeta(settingName);
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(processed, Is.True, "An empty text is a valid choice: none.");
|
||||
Assert.That(this.GetValue(settingName), Is.Empty);
|
||||
Assert.That(configMeta.IsLocked, Is.True);
|
||||
Assert.That(configMeta.LockedByConfigPluginId, Is.EqualTo(PLUGIN_ID));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -83,13 +83,13 @@ public sealed class ManagedGuidSettingTests
|
||||
var processed = await ProcessAsync(PRESELECTED_PROVIDER, string.Empty, allowUserOverride: true);
|
||||
|
||||
var configMeta = GetMeta(PRESELECTED_PROVIDER);
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(processed, Is.True);
|
||||
Assert.That(this.GetValue(PRESELECTED_PROVIDER), Is.Empty, "The default of the organization applies until the user chooses otherwise.");
|
||||
Assert.That(configMeta.IsLocked, Is.False);
|
||||
Assert.That(configMeta.ManagedMode, Is.EqualTo(ManagedConfigurationMode.EDITABLE_DEFAULT));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -97,12 +97,12 @@ public sealed class ManagedGuidSettingTests
|
||||
{
|
||||
var processed = await ProcessAsync(PRESELECTED_PROVIDER, ORGANIZATIONS_PROVIDER_ID.ToUpperInvariant(), allowUserOverride: false);
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(processed, Is.True);
|
||||
Assert.That(this.GetValue(PRESELECTED_PROVIDER), Is.EqualTo(ORGANIZATIONS_PROVIDER_ID));
|
||||
Assert.That(GetMeta(PRESELECTED_PROVIDER).IsLocked, Is.True);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -111,12 +111,12 @@ public sealed class ManagedGuidSettingTests
|
||||
this.SetValue(PRESELECTED_PROVIDER, USERS_PROVIDER_ID);
|
||||
var processed = await ProcessAsync(PRESELECTED_PROVIDER, "not-a-guid", allowUserOverride: false);
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(processed, Is.False);
|
||||
Assert.That(this.GetValue(PRESELECTED_PROVIDER), Is.EqualTo(USERS_PROVIDER_ID), "An invalid ID leaves the choice of the user untouched.");
|
||||
Assert.That(GetMeta(PRESELECTED_PROVIDER).IsLocked, Is.False, "An invalid ID locks nothing.");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -126,12 +126,12 @@ public sealed class ManagedGuidSettingTests
|
||||
await ProcessAsync(PRESELECTED_PROVIDER, string.Empty, allowUserOverride: false);
|
||||
var processed = await ProcessAsync(PRESELECTED_PROVIDER, null, allowUserOverride: false);
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(processed, Is.False);
|
||||
Assert.That(GetMeta(PRESELECTED_PROVIDER).IsLocked, Is.False);
|
||||
Assert.That(this.GetValue(PRESELECTED_PROVIDER), Is.EqualTo(USERS_PROVIDER_ID), "The user gets back the choice made before the plugin took the setting over.");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private string GetValue(string settingName) => PropertyOf(settingName).Compile().Invoke(this.settingsManager.ConfigurationData.App);
|
||||
|
||||
@@ -79,12 +79,12 @@ public sealed class ManagedSettingOwnershipTests
|
||||
var processed = await ProcessProhibitedProvidersAsync(LOCAL_PLUGIN_ID, """{ "MISTRAL" }""");
|
||||
|
||||
ManagedConfiguration.TryGet(x => x.App, x => x.ProhibitedProviders, out var configMeta);
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(processed, Is.False, "The setting of the organization is out of reach of a local plugin.");
|
||||
Assert.That(this.settingsManager.ConfigurationData.App.ProhibitedProviders, Is.EquivalentTo(new[] { LLMProviders.DEEP_SEEK }), "The value of the organization has to stay.");
|
||||
Assert.That(configMeta.LockedByConfigPluginId, Is.EqualTo(ORGANIZATION_PLUGIN_ID), "The organization has to stay the owner of the setting.");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -94,13 +94,13 @@ public sealed class ManagedSettingOwnershipTests
|
||||
var processed = await ProcessUpdateIntervalAsync(LOCAL_PLUGIN_ID, "DAILY", allowUserOverride: false);
|
||||
|
||||
ManagedConfiguration.TryGet(x => x.App, x => x.UpdateInterval, out var configMeta);
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(processed, Is.False, "The editable default of the organization is out of reach of a local plugin.");
|
||||
Assert.That(this.settingsManager.ConfigurationData.App.UpdateInterval, Is.EqualTo(UpdateInterval.WEEKLY), "The value of the organization has to stay.");
|
||||
Assert.That(configMeta.IsLocked, Is.False, "A local plugin must not lock what the organization left to the user.");
|
||||
Assert.That(ManagedConfiguration.GetSettingOwner(configMeta), Is.EqualTo(ORGANIZATION_PLUGIN_ID), "The organization has to stay the owner of the setting.");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -110,12 +110,12 @@ public sealed class ManagedSettingOwnershipTests
|
||||
var processed = await ProcessProhibitedProvidersAsync(SECOND_ORGANIZATION_PLUGIN_ID, """{ "MISTRAL" }""");
|
||||
|
||||
ManagedConfiguration.TryGet(x => x.App, x => x.ProhibitedProviders, out var configMeta);
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(processed, Is.True, "Two configuration plugins of the same organization may override each other.");
|
||||
Assert.That(this.settingsManager.ConfigurationData.App.ProhibitedProviders, Is.EquivalentTo(new[] { LLMProviders.MISTRAL }), "The plugin applied later wins.");
|
||||
Assert.That(configMeta.LockedByConfigPluginId, Is.EqualTo(SECOND_ORGANIZATION_PLUGIN_ID));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -124,12 +124,12 @@ public sealed class ManagedSettingOwnershipTests
|
||||
var processed = await ProcessProhibitedProvidersAsync(LOCAL_PLUGIN_ID, """{ "MISTRAL" }""");
|
||||
|
||||
ManagedConfiguration.TryGet(x => x.App, x => x.ProhibitedProviders, out var configMeta);
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(processed, Is.True, "Without an organization, a local plugin may manage the setting.");
|
||||
Assert.That(this.settingsManager.ConfigurationData.App.ProhibitedProviders, Is.EquivalentTo(new[] { LLMProviders.MISTRAL }));
|
||||
Assert.That(configMeta.LockedByConfigPluginId, Is.EqualTo(LOCAL_PLUGIN_ID));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[TestCase(LOCKED_TOOL_SETTINGS)]
|
||||
@@ -142,12 +142,12 @@ public sealed class ManagedSettingOwnershipTests
|
||||
var processed = await ProcessToolTableAsync(settingName, LOCAL_PLUGIN_ID, ToLuaTable(entry.Key, entry.LocalValue), allowUserOverride: false);
|
||||
|
||||
var configMeta = GetToolTableMeta(settingName);
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(processed, Is.False, "The table of the organization is out of reach of a local plugin.");
|
||||
Assert.That(this.ToolTableOf(settingName), Is.EquivalentTo(new Dictionary<string, string> { [entry.Key] = entry.OrganizationValue }), "The values of the organization have to stay.");
|
||||
Assert.That(configMeta.LockedByConfigPluginId, Is.EqualTo(ORGANIZATION_PLUGIN_ID), "The organization has to stay the owner of the table.");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[TestCase(LOCKED_TOOL_SETTINGS)]
|
||||
@@ -160,13 +160,13 @@ public sealed class ManagedSettingOwnershipTests
|
||||
var processed = await ProcessToolTableAsync(settingName, LOCAL_PLUGIN_ID, ToLuaTable(entry.Key, entry.LocalValue), allowUserOverride: true);
|
||||
|
||||
var configMeta = GetToolTableMeta(settingName);
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(processed, Is.False);
|
||||
Assert.That(configMeta.IsLocked, Is.True, "A local plugin must not hand the user a table the organization locked.");
|
||||
Assert.That(configMeta.LockedByConfigPluginId, Is.EqualTo(ORGANIZATION_PLUGIN_ID));
|
||||
Assert.That(this.ToolTableOf(settingName), Is.EquivalentTo(new Dictionary<string, string> { [entry.Key] = entry.OrganizationValue }));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[TestCase(LOCKED_TOOL_SETTINGS)]
|
||||
@@ -179,13 +179,13 @@ public sealed class ManagedSettingOwnershipTests
|
||||
var processed = await ProcessToolTableAsync(settingName, LOCAL_PLUGIN_ID, ToLuaTable(entry.Key, entry.LocalValue), allowUserOverride: false);
|
||||
|
||||
var configMeta = GetToolTableMeta(settingName);
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(processed, Is.False);
|
||||
Assert.That(configMeta.IsLocked, Is.False, "A local plugin must not lock what the organization left to the user.");
|
||||
Assert.That(ManagedConfiguration.GetSettingOwner(configMeta), Is.EqualTo(ORGANIZATION_PLUGIN_ID), "The organization has to stay the owner of the table.");
|
||||
Assert.That(this.ToolTableOf(settingName), Is.EquivalentTo(new Dictionary<string, string> { [entry.Key] = entry.OrganizationValue }));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[TestCase(LOCKED_TOOL_SETTINGS)]
|
||||
@@ -198,12 +198,12 @@ public sealed class ManagedSettingOwnershipTests
|
||||
var processed = await ProcessToolTableAsync(settingName, SECOND_ORGANIZATION_PLUGIN_ID, ToLuaTable(entry.Key, entry.LocalValue), allowUserOverride: false);
|
||||
|
||||
var configMeta = GetToolTableMeta(settingName);
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(processed, Is.True, "Two configuration plugins of the same organization may override each other.");
|
||||
Assert.That(this.ToolTableOf(settingName), Is.EquivalentTo(new Dictionary<string, string> { [entry.Key] = entry.LocalValue }), "The plugin applied later wins.");
|
||||
Assert.That(configMeta.LockedByConfigPluginId, Is.EqualTo(SECOND_ORGANIZATION_PLUGIN_ID));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[TestCase(LOCKED_TOOL_SETTINGS)]
|
||||
@@ -215,12 +215,12 @@ public sealed class ManagedSettingOwnershipTests
|
||||
var processed = await ProcessToolTableAsync(settingName, LOCAL_PLUGIN_ID, ToLuaTable(entry.Key, entry.LocalValue), allowUserOverride: false);
|
||||
|
||||
var configMeta = GetToolTableMeta(settingName);
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(processed, Is.True, "Without an organization, a local plugin may manage the table.");
|
||||
Assert.That(this.ToolTableOf(settingName), Is.EquivalentTo(new Dictionary<string, string> { [entry.Key] = entry.LocalValue }));
|
||||
Assert.That(configMeta.LockedByConfigPluginId, Is.EqualTo(LOCAL_PLUGIN_ID));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -320,12 +320,12 @@ public sealed class ManagedSettingOwnershipTests
|
||||
await ProcessSettingAsync(settingName, LOCAL_PLUGIN_ID, localValue);
|
||||
var warningsWithDeclaration = recorder.Warnings.Skip(warningsWithoutDeclaration.Count).ToList();
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(warningsWithoutDeclaration, Is.Empty, "A local plugin which does not declare the setting attempts nothing.");
|
||||
Assert.That(warningsWithDeclaration, Has.Count.EqualTo(1), "A local plugin which declares the setting of the organization has to be reported.");
|
||||
Assert.That(warningsWithDeclaration, Has.All.Contains(settingName).And.All.Contains(LOCAL_PLUGIN_ID.ToString()), "The warning has to name the setting and the plugin.");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -39,7 +39,7 @@ public sealed class ModelProfileChainTests
|
||||
[Test]
|
||||
public void EveryModelLeftToTheDefaultIsAnsweredByTheAssumption()
|
||||
{
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
foreach (var left in LeftToTheDefault.ENTRIES)
|
||||
{
|
||||
@@ -50,7 +50,7 @@ public sealed class ModelProfileChainTests
|
||||
|
||||
Assert.That(profile.Capabilities, Is.EqualTo(wanted), $"{left.Provider} \"{left.ModelId}\": {left.Reason}");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -58,7 +58,7 @@ public sealed class ModelProfileChainTests
|
||||
{
|
||||
var profile = LLMProviders.SELF_HOSTED.GetModelProfile(new Model("a-model-nobody-has-heard-of", null));
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(profile.Has(Capability.TEXT_INPUT), Is.True);
|
||||
Assert.That(profile.Has(Capability.TEXT_OUTPUT), Is.True);
|
||||
@@ -67,7 +67,7 @@ public sealed class ModelProfileChainTests
|
||||
Assert.That(profile.Has(Capability.MULTIPLE_IMAGE_INPUT), Is.False, "The assumption says nothing about what a model reads besides text.");
|
||||
Assert.That(profile.Reasoning, Is.EqualTo(ReasoningSupport.NONE));
|
||||
Assert.That(profile.Context.IsKnown, Is.False, "A context window nobody stated is unknown, not a number somebody picked.");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -111,12 +111,12 @@ public sealed class ModelProfileChainTests
|
||||
|
||||
var profile = configured.GetModelProfile();
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(profile.Has(Capability.MULTIPLE_IMAGE_INPUT), Is.True, "The rules say this model reads text only; the person says otherwise and can see their installation.");
|
||||
Assert.That(profile.Has(Capability.FUNCTION_CALLING), Is.False, "And the other way round.");
|
||||
Assert.That(profile.Has(Capability.TEXT_INPUT), Is.True, "Everything nobody said anything about stays as the rules had it.");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -160,11 +160,11 @@ public sealed class ModelProfileChainTests
|
||||
ListedModels.Shared.Report(MACHINE, [new(MODEL.Id, ContextWindow.Of(WHAT_THE_MACHINE_REPORTS))]);
|
||||
var configured = ProviderWith(new() { ContextWindowTokens = 8_192 });
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(configured.GetAutomaticModelProfile().Context.DefaultTokens, Is.EqualTo(WHAT_THE_MACHINE_REPORTS));
|
||||
Assert.That(configured.GetModelProfile().Context.DefaultTokens, Is.EqualTo(8_192), "What the person typed is still what counts everywhere else.");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -26,13 +26,13 @@ public sealed class PluginFilePathTests
|
||||
[Test]
|
||||
public void AFileOfThePluginIsFoundByItsRelativePath()
|
||||
{
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(PluginFilePath.TryResolve("Corporate.pptx", this.pluginDirectory, out var nextToPlugin, out var issue), Is.True, issue);
|
||||
Assert.That(nextToPlugin, Is.EqualTo(Path.Combine(Path.GetFullPath(this.pluginDirectory), "Corporate.pptx")));
|
||||
Assert.That(PluginFilePath.TryResolve("templates/Corporate.potx", this.pluginDirectory, out var inFolder, out issue), Is.True, issue);
|
||||
Assert.That(inFolder, Is.EqualTo(Path.Combine(Path.GetFullPath(this.pluginDirectory), "templates", "Corporate.potx")), "Both kinds of slashes work on every system.");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -40,37 +40,37 @@ public sealed class PluginFilePathTests
|
||||
{
|
||||
var absolutePath = Path.Combine(Path.GetTempPath(), "somewhere", "Corporate.potx");
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(PluginFilePath.TryResolve(string.Empty, this.pluginDirectory, out var empty, out _), Is.True, "An organization may decide on no file at all.");
|
||||
Assert.That(empty, Is.Empty);
|
||||
Assert.That(PluginFilePath.TryResolve(absolutePath, this.pluginDirectory, out var absolute, out _), Is.True, "A file on a network share is the organization's business.");
|
||||
Assert.That(absolute, Is.EqualTo(absolutePath));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void APathLeavingThePluginDirectoryIsRejected()
|
||||
{
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(PluginFilePath.TryResolve("../Corporate.pptx", this.pluginDirectory, out var resolved, out var issue), Is.False);
|
||||
Assert.That(issue, Does.Contain(".."));
|
||||
Assert.That(resolved, Is.Empty);
|
||||
Assert.That(PluginFilePath.TryResolve("templates/../../Corporate.pptx", this.pluginDirectory, out _, out _), Is.False);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AMissingFileIsRejected()
|
||||
{
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(PluginFilePath.TryResolve("Missing.pptx", this.pluginDirectory, out var resolved, out var issue), Is.False);
|
||||
Assert.That(issue, Does.Contain("does not exist"));
|
||||
Assert.That(resolved, Is.Empty);
|
||||
Assert.That(PluginFilePath.TryResolve("Corporate.pptx", string.Empty, out _, out _), Is.False, "Without the plugin directory, a relative path means nothing.");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -78,7 +78,7 @@ public sealed class PluginFilePathTests
|
||||
{
|
||||
var absolutePath = Path.Combine(Path.GetTempPath(), "somewhere", "Corporate.potx");
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(PluginFilePath.TryResolveInside("templates\\Corporate.potx", this.pluginDirectory, out var inFolder, out var issue), Is.True, issue);
|
||||
Assert.That(inFolder, Is.EqualTo(Path.Combine(Path.GetFullPath(this.pluginDirectory), "templates", "Corporate.potx")));
|
||||
@@ -86,7 +86,7 @@ public sealed class PluginFilePathTests
|
||||
Assert.That(issue, Does.Contain("outside"));
|
||||
Assert.That(absolute, Is.Empty);
|
||||
Assert.That(PluginFilePath.TryResolveInside(string.Empty, this.pluginDirectory, out _, out _), Is.False, "An empty path names no file.");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -94,7 +94,7 @@ public sealed class PluginFilePathTests
|
||||
{
|
||||
var absolutePath = Path.Combine(Path.GetTempPath(), "somewhere", "Pictures");
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(PluginFilePath.TryResolveDirectory("templates", this.pluginDirectory, out var inPlugin, out var issue), Is.True, issue);
|
||||
Assert.That(inPlugin, Is.EqualTo(Path.Combine(Path.GetFullPath(this.pluginDirectory), "templates")));
|
||||
@@ -102,13 +102,13 @@ public sealed class PluginFilePathTests
|
||||
Assert.That(empty, Is.Empty);
|
||||
Assert.That(PluginFilePath.TryResolveDirectory(absolutePath, this.pluginDirectory, out var absolute, out _), Is.True, "A folder on a network share is the organization's business.");
|
||||
Assert.That(absolute, Is.EqualTo(absolutePath));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AFolderFollowsTheRulesOfAFile()
|
||||
{
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(PluginFilePath.TryResolveDirectory("templates/../..", this.pluginDirectory, out var resolved, out var issue), Is.False);
|
||||
Assert.That(issue, Does.Contain(".."));
|
||||
@@ -116,6 +116,6 @@ public sealed class PluginFilePathTests
|
||||
Assert.That(PluginFilePath.TryResolveDirectory("Corporate.pptx", this.pluginDirectory, out _, out issue), Is.False, "A file is no folder.");
|
||||
Assert.That(issue, Does.Contain("does not exist"));
|
||||
Assert.That(PluginFilePath.TryResolve("templates", this.pluginDirectory, out _, out _), Is.False, "A folder is no file.");
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -80,12 +80,12 @@ public sealed class PreselectedLayoutsTests
|
||||
await ProcessAsync("""{ ["CHAPTER"] = "Section Header" }""");
|
||||
|
||||
var isManaged = ManagedConfiguration.TryGet(x => x.SlideBuilder, x => x.PreselectedLayouts, out var configMeta);
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(isManaged, Is.True);
|
||||
Assert.That(configMeta.IsLocked, Is.True);
|
||||
Assert.That(configMeta.LockedByConfigPluginId, Is.EqualTo(PLUGIN_ID));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -94,13 +94,13 @@ public sealed class PreselectedLayoutsTests
|
||||
await ProcessAsync("""{ ["CHAPTER"] = "Section Header" }""", allowUserOverride: true);
|
||||
|
||||
var isManaged = ManagedConfiguration.TryGet(x => x.SlideBuilder, x => x.PreselectedLayouts, out var configMeta);
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(isManaged, Is.True);
|
||||
Assert.That(configMeta.IsLocked, Is.False, "With AllowUserOverride, users may change the layouts.");
|
||||
Assert.That(configMeta.EditableDefaultByConfigPluginId, Is.EqualTo(PLUGIN_ID));
|
||||
Assert.That(this.PreselectedLayouts, Is.EquivalentTo(new Dictionary<LayoutPurpose, string> { [LayoutPurpose.CHAPTER] = "Section Header" }), "The first time, the default of the organization applies.");
|
||||
});
|
||||
}
|
||||
|
||||
this.PreselectedLayouts[LayoutPurpose.CHAPTER] = "Chapter";
|
||||
await ProcessAsync("""{ ["CHAPTER"] = "Section Header" }""", allowUserOverride: true);
|
||||
|
||||
@@ -52,11 +52,11 @@ public sealed class PreselectedMaxBulletPointsTests
|
||||
{
|
||||
var processed = await ProcessAsync("5");
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(processed, Is.True);
|
||||
Assert.That(this.PreselectedMaximum, Is.EqualTo(5));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -65,11 +65,11 @@ public sealed class PreselectedMaxBulletPointsTests
|
||||
this.PreselectedMaximum = 3;
|
||||
var processed = await ProcessAsync("0");
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(processed, Is.True, "An organization may decide on no maximum at all.");
|
||||
Assert.That(this.PreselectedMaximum, Is.Zero);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[TestCase("9")]
|
||||
@@ -80,12 +80,12 @@ public sealed class PreselectedMaxBulletPointsTests
|
||||
var processed = await ProcessAsync(configuredMaximum);
|
||||
|
||||
ManagedConfiguration.TryGet(x => x.SlideBuilder, x => x.PreselectedMaxBulletPointsPerSlide, out var configMeta);
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(processed, Is.False);
|
||||
Assert.That(this.PreselectedMaximum, Is.EqualTo(3), "A rejected value leaves the choice of the user untouched.");
|
||||
Assert.That(configMeta.IsLocked, Is.False, "A rejected value locks nothing.");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -94,12 +94,12 @@ public sealed class PreselectedMaxBulletPointsTests
|
||||
await ProcessAsync("5");
|
||||
|
||||
var isManaged = ManagedConfiguration.TryGet(x => x.SlideBuilder, x => x.PreselectedMaxBulletPointsPerSlide, out var configMeta);
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(isManaged, Is.True);
|
||||
Assert.That(configMeta.IsLocked, Is.True);
|
||||
Assert.That(configMeta.LockedByConfigPluginId, Is.EqualTo(PLUGIN_ID));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private int PreselectedMaximum
|
||||
|
||||
@@ -81,12 +81,12 @@ public sealed class PreselectedTemplateSlideUsesTests
|
||||
await ProcessAsync("""{ [1] = "KEEP" }""");
|
||||
|
||||
var isManaged = ManagedConfiguration.TryGet(x => x.SlideBuilder, x => x.PreselectedTemplateSlideUses, out var configMeta);
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(isManaged, Is.True);
|
||||
Assert.That(configMeta.IsLocked, Is.True);
|
||||
Assert.That(configMeta.LockedByConfigPluginId, Is.EqualTo(PLUGIN_ID));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -95,13 +95,13 @@ public sealed class PreselectedTemplateSlideUsesTests
|
||||
await ProcessAsync("""{ [1] = "KEEP" }""", allowUserOverride: true);
|
||||
|
||||
var isManaged = ManagedConfiguration.TryGet(x => x.SlideBuilder, x => x.PreselectedTemplateSlideUses, out var configMeta);
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(isManaged, Is.True);
|
||||
Assert.That(configMeta.IsLocked, Is.False, "With AllowUserOverride, users may change the choices.");
|
||||
Assert.That(configMeta.EditableDefaultByConfigPluginId, Is.EqualTo(PLUGIN_ID));
|
||||
Assert.That(this.PreselectedUses, Is.EquivalentTo(new Dictionary<int, TemplateSlideUse> { [1] = TemplateSlideUse.KEEP }), "The first time, the default of the organization applies.");
|
||||
});
|
||||
}
|
||||
|
||||
this.PreselectedUses[1] = TemplateSlideUse.EDIT;
|
||||
await ProcessAsync("""{ [1] = "KEEP" }""", allowUserOverride: true);
|
||||
|
||||
@@ -58,12 +58,12 @@ public sealed class ProhibitedProvidersTests
|
||||
{
|
||||
await ProcessAsync("""{ "DEEP_SEEK", "mistral" }""");
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(this.settingsManager.ConfigurationData.App.ProhibitedProviders, Is.EquivalentTo(new[] { LLMProviders.DEEP_SEEK, LLMProviders.MISTRAL }), "Names count whatever their case, as everywhere in a configuration.");
|
||||
Assert.That(this.settingsManager.IsProviderProhibited(LLMProviders.DEEP_SEEK), Is.True);
|
||||
Assert.That(this.settingsManager.IsProviderProhibited(LLMProviders.OPEN_AI), Is.False, "A provider the plugin does not name stays allowed.");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -87,12 +87,12 @@ public sealed class ProhibitedProvidersTests
|
||||
await ProcessAsync("""{ "DEEP_SEEK" }""");
|
||||
|
||||
var isManaged = ManagedConfiguration.TryGet(x => x.App, x => x.ProhibitedProviders, out var configMeta);
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(isManaged, Is.True);
|
||||
Assert.That(configMeta.IsLocked, Is.True, "Users must not lift a prohibition of their organization.");
|
||||
Assert.That(configMeta.LockedByConfigPluginId, Is.EqualTo(PLUGIN_ID));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -129,11 +129,11 @@ public sealed class ProhibitedProvidersTests
|
||||
|
||||
var selectable = this.settingsManager.GetConfidentProviders(AIStudio.Tools.Components.CHAT).Select(x => x.Id).ToList();
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(selectable, Is.EqualTo(new[] { ALLOWED_PROVIDER_ID }), "A prohibited provider must not be offered, whatever its confidence level.");
|
||||
Assert.That(this.settingsManager.GetAllProviders(), Has.Count.EqualTo(2), "The settings still list it, so that the user can see and delete it.");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -144,11 +144,11 @@ public sealed class ProhibitedProvidersTests
|
||||
this.settingsManager.ConfigurationData.App.PreselectedProvider = PROHIBITED_PROVIDER_ID;
|
||||
this.settingsManager.ConfigurationData.App.ProhibitedProviders.Add(LLMProviders.DEEP_SEEK);
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(this.settingsManager.GetPreselectedProvider(AIStudio.Tools.Components.CHAT, PROHIBITED_PROVIDER_ID), Is.EqualTo(AIStudio.Settings.Provider.NONE), "Neither the current provider nor the app-wide default may hand over a prohibited provider.");
|
||||
Assert.That(this.settingsManager.GetChatProviderForLoadedChat(PROHIBITED_PROVIDER_ID).Id, Is.Not.EqualTo(PROHIBITED_PROVIDER_ID), "A chat stored with a prohibited provider has to continue with another one.");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -178,12 +178,12 @@ public sealed class ProhibitedProvidersTests
|
||||
var prohibited = this.settingsManager.GetProviderById(PROHIBITED_PROVIDER_ID);
|
||||
ChatThread? newChat = null;
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(newChat.IsLLMProviderAllowed(prohibited), Is.False, "Even a new chat, which has no requirements yet, must not use a prohibited provider.");
|
||||
Assert.That(new ChatThread().IsLLMProviderAllowed(prohibited), Is.False);
|
||||
Assert.That(newChat.IsLLMProviderAllowed(allowed), Is.True);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -195,11 +195,11 @@ public sealed class ProhibitedProvidersTests
|
||||
|
||||
this.settingsManager.ConfigurationData.App.ProhibitedProviders.Add(LLMProviders.MISTRAL);
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(DataSourceEmbeddingProviders.TryResolve(this.settingsManager, dataSource, out _), Is.False, "Indexing and searching must not embed anything with a prohibited provider.");
|
||||
Assert.That(DataSourceEmbeddingProviders.IsProhibited(this.settingsManager, dataSource), Is.True, "The status of the data source has to name the prohibition as the reason.");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -251,13 +251,13 @@ public sealed class ProhibitedProvidersTests
|
||||
var transcriptionProvider = new TranscriptionProvider { Id = Guid.NewGuid().ToString(), UsedLLMProvider = LLMProviders.DEEP_SEEK };
|
||||
this.settingsManager.ConfigurationData.App.ProhibitedProviders.Add(LLMProviders.DEEP_SEEK);
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(this.settingsManager.GetProviderById(PROHIBITED_PROVIDER_ID).CreateProvider(), Is.TypeOf<NoProvider>());
|
||||
Assert.That(embeddingProvider.CreateProvider(), Is.TypeOf<NoProvider>());
|
||||
Assert.That(transcriptionProvider.CreateProvider(), Is.TypeOf<NoProvider>());
|
||||
Assert.That(this.settingsManager.GetProviderById(ALLOWED_PROVIDER_ID).CreateProvider(), Is.Not.TypeOf<NoProvider>(), "Providers the organization did not prohibit are created as before.");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -265,7 +265,7 @@ public sealed class ProhibitedProvidersTests
|
||||
{
|
||||
this.settingsManager.ConfigurationData.App.ProhibitedProviders.Add(LLMProviders.DEEP_SEEK);
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
foreach (var scheme in Enum.GetValues<AIStudio.Tools.ConfidenceSchemes>())
|
||||
{
|
||||
@@ -273,7 +273,7 @@ public sealed class ProhibitedProvidersTests
|
||||
Assert.That(LLMProviders.DEEP_SEEK.GetConfidence(this.settingsManager).Level, Is.EqualTo(ConfidenceLevel.UNTRUSTED), $"The scheme {scheme} must not trust a prohibited provider.");
|
||||
Assert.That(LLMProviders.OPEN_AI.GetConfidence(this.settingsManager).Level, Is.Not.EqualTo(ConfidenceLevel.UNTRUSTED), $"Under the scheme {scheme}, a provider the organization did not prohibit keeps its level.");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -291,11 +291,11 @@ public sealed class ProhibitedProvidersTests
|
||||
confidence.CustomConfidenceScheme[LLMProviders.DEEP_SEEK] = ConfidenceLevel.HIGH;
|
||||
this.settingsManager.ConfigurationData.App.ProhibitedProviders.Add(LLMProviders.DEEP_SEEK);
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(this.settingsManager.GetConfiguredConfidenceLevel(LLMProviders.DEEP_SEEK), Is.EqualTo(ConfidenceLevel.UNTRUSTED), "The prohibition comes before the chosen level.");
|
||||
Assert.That(confidence.CustomConfidenceScheme[LLMProviders.DEEP_SEEK], Is.EqualTo(ConfidenceLevel.HIGH), "The chosen level stays stored.");
|
||||
});
|
||||
}
|
||||
|
||||
this.settingsManager.ConfigurationData.App.ProhibitedProviders.Remove(LLMProviders.DEEP_SEEK);
|
||||
|
||||
|
||||
@@ -55,12 +55,12 @@ public sealed class ProviderCapabilityOverridesTests
|
||||
// also what makes these four the cheapest guard there is against somebody rearranging the
|
||||
// resolution below them.
|
||||
//
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
foreach (var (overrides, means) in WHAT_THE_DIALOG_WRITES)
|
||||
foreach (var stated in EVERY_STATE)
|
||||
Assert.That(overrides.ApplyTo(ProfileWhichReasons(stated)).Reasoning, Is.EqualTo(means), $"A model which reasons {stated}, with {Describe(overrides)}.");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -109,14 +109,14 @@ public sealed class ProviderCapabilityOverridesTests
|
||||
var overrides = new ProviderCapabilityOverrides { FunctionCalling = false, AudioInput = true };
|
||||
var after = overrides.ApplyTo(profile);
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(after.Has(Capability.FUNCTION_CALLING), Is.False);
|
||||
Assert.That(after.Has(Capability.AUDIO_INPUT), Is.True);
|
||||
Assert.That(after.Has(Capability.TEXT_INPUT), Is.True);
|
||||
Assert.That(after.Has(Capability.SINGLE_IMAGE_INPUT), Is.True, "Turning several images off is what removes several images; one image is a statement of its own.");
|
||||
Assert.That(after.Context, Is.EqualTo(profile.Context));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -51,12 +51,12 @@ public sealed class ProviderLuaExportTests
|
||||
var modelId = ModelIdOf(type);
|
||||
var (luaCode, readBack) = await ExportAndReadBackAsync(type, $@"C:\Users\Jane Doe\AppData\Roaming\com.github.mindwork-ai.ai-studio\data\tokenizers\{modelId}\tokenizer.json");
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(readBack, Is.EqualTo($"tokenizers/{modelId}/tokenizer.json"), "A configuration plugin reads the path relative to its own folder.");
|
||||
Assert.That(luaCode, Does.Not.Contain("Jane"));
|
||||
Assert.That(luaCode, Does.Not.Contain("C:"));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[TestCase(PluginConfigurationObjectType.LLM_PROVIDER)]
|
||||
@@ -75,11 +75,11 @@ public sealed class ProviderLuaExportTests
|
||||
{
|
||||
var (luaCode, readBack) = await ExportAndReadBackAsync(type, string.Empty);
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(readBack, Is.Empty);
|
||||
Assert.That(luaCode, Does.Contain("""["TokenizerPath"] = "",""").And.Not.Contain("tokenizer of its own"));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[TestCase(PluginConfigurationObjectType.LLM_PROVIDER)]
|
||||
@@ -98,11 +98,11 @@ public sealed class ProviderLuaExportTests
|
||||
var synced = await PluginConfigurationObject.SyncTokenizerAsync(storage, exportedPath, string.Empty, pluginDirectory, modelId, "the exported provider");
|
||||
var syncedWithTheAbsolutePath = await PluginConfigurationObject.SyncTokenizerAsync(storage, copyInTheDataDirectory, string.Empty, pluginDirectory, modelId, "the exported provider");
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(synced.Path, Is.EqualTo(fileInThePlugin), "The administrator copies the file to the same place in the plugin, where the plugin looks for it.");
|
||||
Assert.That(syncedWithTheAbsolutePath, Is.EqualTo(StoredTokenizer.NONE), "What the export wrote before lies outside of the plugin, so the plugin ignored it.");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private static string ModelIdOf(PluginConfigurationObjectType type) => type switch
|
||||
|
||||
@@ -42,13 +42,13 @@ public sealed class ProviderNumberOverridesTests
|
||||
var overrides = new ProviderCapabilityOverrides { ContextWindowTokens = 32_768 };
|
||||
var after = overrides.ApplyTo(WHAT_THE_RULES_SAY);
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(after.Context.DefaultTokens, Is.EqualTo(32_768));
|
||||
Assert.That(after.Context.RaisableToTokens, Is.Null, "What the model card says it could be raised to is not a property of this installation.");
|
||||
Assert.That(after.Images, Is.EqualTo(WHAT_THE_RULES_SAY.Images), "Stating a window says nothing about pictures.");
|
||||
Assert.That(after.Capabilities, Is.EqualTo(WHAT_THE_RULES_SAY.Capabilities));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -56,11 +56,11 @@ public sealed class ProviderNumberOverridesTests
|
||||
{
|
||||
var after = new ProviderCapabilityOverrides().ApplyTo(WHAT_THE_RULES_SAY);
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(after.Context, Is.EqualTo(WHAT_THE_RULES_SAY.Context));
|
||||
Assert.That(after.Images, Is.EqualTo(WHAT_THE_RULES_SAY.Images));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -69,12 +69,12 @@ public sealed class ProviderNumberOverridesTests
|
||||
var overrides = new ProviderCapabilityOverrides { MaxImagesPerMessage = 4 };
|
||||
var after = overrides.ApplyTo(WHAT_THE_RULES_SAY);
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(after.Images.MaxPerMessage, Is.EqualTo(4));
|
||||
Assert.That(after.Images.MaxPerRequest, Is.EqualTo(20), "Nobody contradicted the request limit, so it stands.");
|
||||
Assert.That(after.Images.MaxInOneMessage, Is.EqualTo(4));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -88,11 +88,11 @@ public sealed class ProviderNumberOverridesTests
|
||||
var rules = WHAT_THE_RULES_SAY with { Images = new(3, null) };
|
||||
var after = new ProviderCapabilityOverrides { MaxImagesPerRequest = 100 }.ApplyTo(rules);
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(after.Images.MaxPerRequest, Is.EqualTo(100));
|
||||
Assert.That(after.Images.MaxInOneMessage, Is.EqualTo(3));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -100,11 +100,11 @@ public sealed class ProviderNumberOverridesTests
|
||||
{
|
||||
var after = new ProviderCapabilityOverrides { MaxImagesPerRequest = 0 }.ApplyTo(WHAT_THE_RULES_SAY);
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(after.Images.IsKnown, Is.True);
|
||||
Assert.That(after.Images.MaxInOneMessage, Is.EqualTo(0));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[TestCase(0)]
|
||||
@@ -134,13 +134,13 @@ public sealed class ProviderNumberOverridesTests
|
||||
// The dialog throws the record away when this says false, so a person who set nothing but a
|
||||
// window would watch their number disappear on the way out of the dialog.
|
||||
//
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(new ProviderCapabilityOverrides { ContextWindowTokens = 8_192 }.HasOverrides, Is.True);
|
||||
Assert.That(new ProviderCapabilityOverrides { MaxImagesPerMessage = 1 }.HasOverrides, Is.True);
|
||||
Assert.That(new ProviderCapabilityOverrides { MaxImagesPerRequest = 0 }.HasOverrides, Is.True, "Zero is a statement, and the person made it.");
|
||||
Assert.That(new ProviderCapabilityOverrides().HasOverrides, Is.False);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -157,14 +157,14 @@ public sealed class ProviderNumberOverridesTests
|
||||
var json = JsonSerializer.Serialize(written);
|
||||
var read = JsonSerializer.Deserialize<ProviderCapabilityOverrides>(json);
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(read, Is.EqualTo(written));
|
||||
Assert.That(json, Does.Contain("\"CONTEXT_WINDOW\""), "The key names are the surface an administrator sees; they are not free to change.");
|
||||
Assert.That(json, Does.Contain("\"MAX_IMAGES_PER_MESSAGE\""));
|
||||
Assert.That(json, Does.Contain("\"MAX_IMAGES_PER_REQUEST\""));
|
||||
Assert.That(json, Does.Not.Contain("AUDIO_INPUT"), "Saying nothing is not the same as saying null, and a settings file should not be full of it.");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -193,11 +193,11 @@ public sealed class ProviderNumberOverridesTests
|
||||
""");
|
||||
|
||||
Assert.That(read, Is.Not.Null);
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(read!.ContextWindowTokens, Is.EqualTo(32_768));
|
||||
Assert.That(read.MaxImagesPerRequest, Is.EqualTo(4), "The capability words are read loosely too, and a table is read by the app rather than by a compiler.");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[TestCase("[\"CONTEXT_WINDOW\"] = 0", TestName = "A window of no tokens")]
|
||||
@@ -220,12 +220,12 @@ public sealed class ProviderNumberOverridesTests
|
||||
""");
|
||||
|
||||
Assert.That(read, Is.Not.Null);
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(read!.VideoInput, Is.EqualTo(false));
|
||||
Assert.That(read.ContextWindowTokens, Is.Null);
|
||||
Assert.That(read.MaxImagesPerRequest, Is.Null);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -83,13 +83,13 @@ public sealed class SettingsStorageTests
|
||||
var settingsPath = Path.Combine(this.testDirectory, SETTINGS_FILENAME);
|
||||
var backupPath = Path.Combine(this.testDirectory, BACKUP_FILENAME);
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(File.Exists(settingsPath), Is.True, "The settings file was never written.");
|
||||
Assert.That(File.Exists(backupPath), Is.True, "The settings backup file was never written.");
|
||||
Assert.That(ReadSettingsFile(settingsPath)?.Version, Is.EqualTo(Version.V6), "The settings file could not be read back.");
|
||||
Assert.That(ReadSettingsFile(backupPath)?.Version, Is.EqualTo(Version.V6), "The settings backup file could not be read back.");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -137,11 +137,11 @@ public sealed class SettingsStorageTests
|
||||
await Task.WhenAll(operations);
|
||||
|
||||
using var settingsDocument = JsonDocument.Parse(await File.ReadAllTextAsync(settingsPath));
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(settingsDocument.RootElement.GetProperty("Version").GetString(), Is.EqualTo("V99"), "A store overwrote the newer settings file while a read was reconsidering the write block.");
|
||||
Assert.That(settingsManager.SettingsWriteBlockReason, Is.EqualTo(SettingsWriteBlockReason.VERSION_NEWER_THAN_APP), "The write block did not survive the reads which re-established it.");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -40,11 +40,11 @@ public sealed class TranscriptionConfidenceTests
|
||||
public void AFolderWhichAsksForAHighLevelKeepsItsRecordingsFromAMediumProvider()
|
||||
{
|
||||
var directory = new DataSourceLocalDirectory { ConfidenceLevel = ConfidenceLevel.HIGH };
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(DataSourceEmbeddingService.AllowsTranscription(directory, ConfidenceLevel.MEDIUM), Is.False);
|
||||
Assert.That(DataSourceEmbeddingService.AllowsTranscription(directory, ConfidenceLevel.HIGH), Is.True);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
Reference in new issue
Block a user