using AIRuntime.Runtime.Agents;
using AIRuntime.Runtime.Agents.BuiltIn;
using AIRuntime.Runtime.Agents.Runtime;

using NUnit.Framework;


namespace AIRuntime.Tests
{
    public sealed class AgentExecutionContextCapabilityTests
    {
        [Test]
        public void Context_ContainsAgentCapabilities()
        {
            AgentDefinition agent =
                new AgentDefinition(
                    "TestAgent",
                    "Test Agent",
                    "",
                    "");


            agent.AddCapability(
                "read_file");


            agent.AddCapability(
                "write_file");


            AgentSession session =
                new AgentSession(
                    agent);


            AgentExecutionContext context =
                new AgentExecutionContext(
                    session);


            Assert.AreEqual(
                2,
                context.AllowedCapabilities.Count);


            CollectionAssert.Contains(
                context.AllowedCapabilities,
                "read_file");


            CollectionAssert.Contains(
                context.AllowedCapabilities,
                "write_file");
        }



        [Test]
        public void Context_UsesDefinitionCapabilities()
        {
            AgentDefinition agent =
                ArchitectAgentDefinition.Create();


            AgentSession session =
                new AgentSession(
                    agent);


            AgentExecutionContext context =
                new AgentExecutionContext(
                    session);


            Assert.AreSame(
                agent.Capabilities,
                context.AllowedCapabilities);
        }



        [Test]
        public void Context_NullSessionThrows()
        {
            Assert.Throws<System.ArgumentNullException>(
                () =>
                {
                    new AgentExecutionContext(
                        null);
                });
        }
    }
}