using NUnit.Framework;
using LLM.Editor.Analysis;
using System.Collections.Generic;
using System.Linq;

namespace LLM.Editor.Tests.Unit
{
    [TestFixture]
    public class PackageManagerProviderTests
    {
        [Test]
        public void GetContext_ReturnsListOfInstalledPackages()
        {
            // Arrange
            var provider = new PackageManagerProvider();

            // Act
            var context = provider.GetContext(null, null);

            // Assert
            Assert.IsInstanceOf<List<PackageManagerProvider.PackageInfo>>(context, "The provider should return a list of PackageInfo objects.");
            var packages = (List<PackageManagerProvider.PackageInfo>)context;
            
            Assert.IsNotEmpty(packages, "The package list should not be empty.");

            // Check for the presence of some common packages that should exist in this project.
            var packageNames = packages.Select(p => p.name).ToList();
            
            Assert.Contains("com.unity.test-framework", packageNames);
            Assert.Contains("com.unity.modules.unitywebrequest", packageNames);
            Assert.Contains("com.unity.modules.ui", packageNames);
        }
    }
}