using System; using System.Threading.Tasks; namespace TestNamespace { /// /// A test class with various members for testing the mcilspy MCP server. /// public class TestClass { // Constants for testing string search public const string API_KEY = "test-secret-key"; public const string BASE_URL = "https://api.example.com"; public const int MAX_RETRIES = 3; // Fields public static readonly string BaseUrl = "https://api.example.com"; private int _privateField; protected string _protectedField; internal double _internalField; // Properties public string Name { get; set; } public int Age { get; private set; } public virtual bool IsActive { get; set; } // Events public event EventHandler OnChange; public event EventHandler OnMessage; // Constructors public TestClass() { Name = "Default"; Age = 0; } public TestClass(string name, int age) { Name = name; Age = age; } // Methods public void DoSomething() { Console.WriteLine("Hello from DoSomething"); OnChange?.Invoke(this, EventArgs.Empty); } public string GetGreeting() { return $"Hello, {Name}!"; } public static int Add(int a, int b) { return a + b; } protected virtual void OnPropertyChanged(string propertyName) { OnMessage?.Invoke(this, propertyName); } private void PrivateMethod() { _privateField = 42; } } /// /// Interface for testing interface discovery. /// public interface ITestService { void Execute(); Task ExecuteAsync(); string ServiceName { get; } } /// /// Another interface for inheritance testing. /// public interface IConfigurable { void Configure(string settings); } /// /// Struct for testing struct discovery. /// public struct TestStruct { public int Value; public string Label; public TestStruct(int value, string label) { Value = value; Label = label; } public override string ToString() => $"{Label}: {Value}"; } /// /// Enum for testing enum discovery. /// public enum TestEnum { None = 0, First = 1, Second = 2, Third = 3 } /// /// Delegate for testing delegate discovery. /// public delegate void TestDelegate(string message); /// /// Delegate with return type. /// public delegate bool ValidationDelegate(T value); /// /// Service implementation for testing class relationships. /// public class TestServiceImpl : ITestService, IConfigurable { private string _config; public string ServiceName => "TestService"; public void Execute() { Console.WriteLine($"Executing with config: {_config}"); } public Task ExecuteAsync() { return Task.FromResult($"Async result from {ServiceName}"); } public void Configure(string settings) { _config = settings; } } /// /// Nested class for testing nested type discovery. /// public class OuterClass { public class NestedClass { public string Value { get; set; } } private class PrivateNestedClass { public int Secret { get; set; } } public NestedClass CreateNested() => new NestedClass(); } /// /// Abstract class for testing abstract type discovery. /// public abstract class AbstractBase { public abstract void AbstractMethod(); public virtual void VirtualMethod() { } protected string BaseProperty { get; set; } } /// /// Derived class for testing inheritance. /// public class DerivedClass : AbstractBase { public override void AbstractMethod() { Console.WriteLine("Implemented abstract method"); } public override void VirtualMethod() { base.VirtualMethod(); Console.WriteLine("Overridden virtual method"); } } } namespace TestNamespace.SubNamespace { /// /// Class in a sub-namespace for testing namespace filtering. /// public class SubClass { public const string CONNECTION_STRING = "Server=localhost;Database=test"; public void SubMethod() { Console.WriteLine("Sub namespace method"); } } }