Assert.That(registry.NormalizeSelection([toolId]),Is.EquivalentTo(new[]{MAILBOXES}),"A selection stored before the tool joined its collection selects the whole collection.");
Assert.That(registry.ExpandSelection([toolId]),Is.EquivalentTo(new[]{SEARCH_MAILS,READ_MAIL,COUNT_MAILS}),"The model sees each tool of the collection on its own.");
Assert.That(this.CreateAppRegistry().NormalizeSelection([SEARCH_CONFLUENCE]),Is.EquivalentTo(new[]{SEARCH_CONFLUENCE,READ_WEB_PAGE}),"The search only finds pages; without Read Web Page the model could not open a single result.");
Assert.That(this.CreateAppRegistry().NormalizeSelection([toolId]),Is.EquivalentTo(new[]{toolId}),"Only the search of the wiki depends on another tool. The reader in particular does not pull a search in.");
Assert.That(this.CreateAppRegistry().NormalizeSelection([SEMANTIC_SEARCH,WEB_SEARCH]),Is.EquivalentTo(new[]{WEB_SEARCH}),"Semantic Search offers itself from the data sources of a chat. A template or a plugin naming it would put a tool on the security card that the selection has no say over.");
}
[Test]
publicvoidAnUnknownToolStaysInTheSelection()
{
varregistry=this.CreateAppRegistry();
Assert.Multiple(()=>
{
Assert.That(registry.NormalizeSelection(["tool_of_a_plugin"]),Is.EquivalentTo(new[]{"tool_of_a_plugin"}),"The tool may arrive with a plugin installed later.");
Assert.That(registry.NormalizeSelection(once),Is.EquivalentTo(once),"The selection fields normalize whatever they receive, including a selection they normalized themselves a moment ago.");
Assert.That(registry.NormalizeSelection([MAILBOXES,SEARCH_MAILS,READ_MAIL]),Has.Count.EqualTo(1),"The collection and two of its tools are the same selection.");
Assert.That(selected,Is.EquivalentTo(new[]{SEARCH_CONFLUENCE,READ_MAIL}),"The caller's set, such as the tools of a stored chat template, must not change behind its back.");
Assert.That(catalog.Select(item=>item.Id),Is.EquivalentTo(new[]{MAILBOXES,WEB_SEARCH,READ_WEB_PAGE,SEARCH_CONFLUENCE}),"Semantic Search is nobody's to select, and the mail tools are one entry.");
Assert.That(mailboxes.Tools.Select(tool=>tool.Definition.Id),Is.EqualTo(new[]{SEARCH_MAILS,READ_MAIL,COUNT_MAILS}),"In the order the collection lists them.");
Assert.That(awaitthis.CreateAppRegistry().FilterSelectableToolIdsAsync(AIStudio.Tools.Components.CHAT,[COUNT_MAILS]),Is.EquivalentTo(new[]{MAILBOXES}),"A launcher naming one mail tool opens the chat with the collection selected.");
Assert.That(registry.GetDefaultToolIds(AIStudio.Tools.Components.CHAT),Is.EquivalentTo(new[]{MAILBOXES}),"Defaults stored before the collection existed preselect it.");
}
/// <summary>
/// The tools of the app as far as selecting them goes, with the mailbox collection.