using AxCopilot.Models; using AxCopilot.Services.Agent; using FluentAssertions; using Xunit; namespace AxCopilot.Tests.Services; public class AgentTabSettingsResolverTests { [Theory] [InlineData("Code", true, false)] [InlineData("Cowork", false, true)] [InlineData("Chat", false, false)] [InlineData(null, false, false)] public void TabDetection_ShouldMatchExpected(string? tab, bool isCode, bool isCowork) { AgentTabSettingsResolver.IsCodeTab(tab).Should().Be(isCode); AgentTabSettingsResolver.IsCoworkTab(tab).Should().Be(isCowork); } [Fact] public void IsPostToolVerificationEnabled_ShouldUseTabSpecificFlags() { var llm = new LlmSettings { EnableCoworkVerification = true, Code = new CodeSettings { EnableCodeVerification = false, } }; AgentTabSettingsResolver.IsPostToolVerificationEnabled("Cowork", llm).Should().BeTrue(); AgentTabSettingsResolver.IsPostToolVerificationEnabled("Code", llm).Should().BeFalse(); AgentTabSettingsResolver.IsPostToolVerificationEnabled("Chat", llm).Should().BeFalse(); } [Fact] public void EnumerateCodeTabDisabledTools_ShouldReflectCodeSettings() { var code = new CodeSettings { EnableWorktreeTools = true, EnableTeamTools = false, EnableCronTools = false, }; var disabled = AgentTabSettingsResolver.EnumerateCodeTabDisabledTools(code).ToList(); disabled.Should().Contain(["enter_plan_mode", "exit_plan_mode"]); disabled.Should().Contain(["team_create", "team_delete"]); disabled.Should().Contain(["cron_create", "cron_delete", "cron_list"]); disabled.Should().NotContain(["enter_worktree", "exit_worktree"]); } }