30 lines
739 B
C#
30 lines
739 B
C#
using backend.Tools;
|
|
using FluentAssertions;
|
|
using Xunit;
|
|
|
|
namespace backend.tests;
|
|
|
|
public class ToolRegistryTests
|
|
{
|
|
private readonly ITool[] _all = new ITool[]
|
|
{
|
|
new GetCurrentTimeTool(),
|
|
};
|
|
|
|
[Fact]
|
|
public void Get_returns_tool_by_exact_name()
|
|
{
|
|
var reg = new ToolRegistry(_all);
|
|
reg.Get("get_current_time").Should().NotBeNull();
|
|
reg.Get("does_not_exist").Should().BeNull();
|
|
}
|
|
|
|
[Fact]
|
|
public void Filter_returns_only_enabled_tools_preserving_order()
|
|
{
|
|
var reg = new ToolRegistry(_all);
|
|
var enabled = new HashSet<string> { "get_current_time", "ghost" };
|
|
reg.EnabledFor(enabled).Select(t => t.Name).Should().Equal("get_current_time");
|
|
}
|
|
}
|