diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 7937a3d..7a7ad06 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -8,7 +8,6 @@ on: push: branches: - develop - pull_request: schedule: - cron: '0 6 * * 1' # Every Monday at 06:00 UTC @@ -29,10 +28,7 @@ jobs: uses: github/codeql-action/init@v4 with: languages: csharp - build-mode: manual - - - name: Build - run: dotnet build ProjGraph.slnx --configuration Release + build-mode: autobuild - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v4 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index aa18ba6..a97e512 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -57,13 +57,13 @@ dotnet test tests/ProjGraph.Tests.Unit.ClassDiagram --filter "ClassAnalysisDepth ### Test Organisation -| Project | Purpose | -|-------------------------|-------------------------------------------------------------------------| -| `Tests.Unit.*` | Unit tests per library | -| `Tests.Integration.Cli` | CLI end-to-end tests | -| `Tests.Integration.Mcp` | MCP tool integration tests | -| `Tests.Contract` | MCP contract validation & DI wiring | -| `Tests.Shared` | Shared helpers (`TestDirectory`, `NullOutputConsole`, `TestPathHelper`) | +| Project | Purpose | +|-------------------------|----------------------------------------------------| +| `Tests.Unit.*` | Unit tests per library | +| `Tests.Integration.Cli` | CLI end-to-end tests | +| `Tests.Integration.Mcp` | MCP tool integration tests | +| `Tests.Contract` | MCP contract validation & DI wiring | +| `Tests.Shared` | Shared helpers (`TestDirectory`, `TestPathHelper`) | ## Adding a New Feature diff --git a/specs/004-config-class-members/data-model.md b/specs/004-config-class-members/data-model.md index e72b2f0..60f0a6d 100644 --- a/specs/004-config-class-members/data-model.md +++ b/specs/004-config-class-members/data-model.md @@ -4,19 +4,19 @@ The `AnalysisOptions` class in `ProjGraph.Lib.ClassDiagram` will be extended with the following fields: -| Field | Type | Default | Description | -|-------|------|---------|-------------| -| IncludeProperties | bool | true | When true, includes properties and fields in the type definition. | +| Field | Type | Default | Description | +|-------|------|---------|------------------------------------------------------------------------------------------------------------------------------------| +| IncludeProperties | bool | true | When true, includes properties and fields in the type definition. | | IncludeFunctions | bool | true | When true, includes methods in the type definition. Constructors are not currently extracted by the analyzer and are out of scope. | ## Entity: MemberDefinition (Reference) Existing entity in `ProjGraph.Core.Models`. -| Field | Type | Category mapping | -|-------|------|------------------| +| Field | Type | Category mapping | +|-------|------|----------------------------| | Kind | MemberKind | Property, Field -> "Properties" | -| Kind | MemberKind | Method -> "Functions" | +| Kind | MemberKind | Method -> "Functions" | Note: The `MemberKind` enum contains `Field = 0`, `Property = 1`, `Method = 2`. There is no `Constructor` value — constructors are not extracted by `TypeAnalyzer` and are out of scope. diff --git a/src/ProjGraph.Cli/Commands/ClassDiagramCommand.cs b/src/ProjGraph.Cli/Commands/ClassDiagramCommand.cs index 4b20777..9d35850 100644 --- a/src/ProjGraph.Cli/Commands/ClassDiagramCommand.cs +++ b/src/ProjGraph.Cli/Commands/ClassDiagramCommand.cs @@ -130,13 +130,14 @@ public override async Task ExecuteAsync( { try { - var model = await analysisService.AnalyzeFileAsync( - settings.Path, + var options = new AnalysisOptions( + settings.Depth, settings.IncludeInheritance, settings.IncludeDependencies, settings.IncludeProperties, - settings.IncludeFunctions, - settings.Depth); + settings.IncludeFunctions); + + var model = await analysisService.AnalyzeFileAsync(settings.Path, options); var mermaidOutput = mermaidRenderer.Render(model, new DiagramOptions(settings.ShowTitle)); console.WriteLine(mermaidOutput); diff --git a/src/ProjGraph.Lib.ClassDiagram/Application/AnalysisOptions.cs b/src/ProjGraph.Lib.ClassDiagram/Application/AnalysisOptions.cs index 80c8e6e..cfc2a1d 100644 --- a/src/ProjGraph.Lib.ClassDiagram/Application/AnalysisOptions.cs +++ b/src/ProjGraph.Lib.ClassDiagram/Application/AnalysisOptions.cs @@ -1,32 +1,23 @@ +using System.ComponentModel; + namespace ProjGraph.Lib.ClassDiagram.Application; /// /// Represents the options for configuring the analysis process, such as depth and inclusion of relationships. /// -public sealed class AnalysisOptions -{ - /// - /// The maximum depth of type relationships to analyze. - /// - public required int MaxDepth { get; init; } - - /// - /// Indicates whether inheritance relationships should be included in the analysis. - /// - public required bool IncludeInheritance { get; init; } - - /// - /// Indicates whether dependency relationships should be included in the analysis. - /// - public required bool IncludeDependencies { get; init; } - - /// - /// Indicates whether properties and fields should be included in the analysis. - /// - public required bool IncludeProperties { get; init; } - - /// - /// Indicates whether functions and methods should be included in the analysis. - /// - public required bool IncludeFunctions { get; init; } -} +/// The maximum depth of type relationships to analyze. +/// Indicates whether inheritance relationships should be included in the analysis. +/// Indicates whether dependency relationships should be included in the analysis. +/// Indicates whether properties and fields should be included in the analysis. +/// Indicates whether functions and methods should be included in the analysis. +public record AnalysisOptions( + [Description("How many levels of relationships to follow (default: 1).")] + int MaxDepth = 1, + [Description("Whether to search the workspace for base classes and interfaces.")] + bool IncludeInheritance = false, + [Description("Whether to search for and include other classes used as properties or fields.")] + bool IncludeDependencies = false, + [Description("Whether to display properties and fields in the class diagram (default: true).")] + bool IncludeProperties = true, + [Description("Whether to display functions/methods in the class diagram (default: true).")] + bool IncludeFunctions = true); diff --git a/src/ProjGraph.Lib.ClassDiagram/Application/ClassAnalysisService.cs b/src/ProjGraph.Lib.ClassDiagram/Application/ClassAnalysisService.cs index 55e871d..04a4b21 100644 --- a/src/ProjGraph.Lib.ClassDiagram/Application/ClassAnalysisService.cs +++ b/src/ProjGraph.Lib.ClassDiagram/Application/ClassAnalysisService.cs @@ -13,18 +13,8 @@ public class ClassAnalysisService(AnalyzeFileUseCase analyzeFileUseCase) : IClas /// public async Task AnalyzeFileAsync( string filePath, - bool includeInheritance = false, - bool includeDependencies = false, - bool includeProperties = true, - bool includeFunctions = true, - int maxDepth = 1) + AnalysisOptions? options = null) { - return await analyzeFileUseCase.ExecuteAsync( - filePath, - includeInheritance, - includeDependencies, - includeProperties, - includeFunctions, - maxDepth); + return await analyzeFileUseCase.ExecuteAsync(filePath, options); } } diff --git a/src/ProjGraph.Lib.ClassDiagram/Application/IClassAnalysisService.cs b/src/ProjGraph.Lib.ClassDiagram/Application/IClassAnalysisService.cs index 16f78d8..ad0042b 100644 --- a/src/ProjGraph.Lib.ClassDiagram/Application/IClassAnalysisService.cs +++ b/src/ProjGraph.Lib.ClassDiagram/Application/IClassAnalysisService.cs @@ -11,17 +11,7 @@ public interface IClassAnalysisService /// Analyzes a specific C# file and optionally discovers its relationships in the workspace. /// /// Target .cs file path. - /// Whether to discover base classes/interfaces. - /// Whether to discover types used in members. - /// Whether to include properties and fields. - /// Whether to include functions and methods. - /// Depth of relationship discovery. + /// The analysis options. /// A ClassModel representing the discovered types and relationships. - Task AnalyzeFileAsync( - string filePath, - bool includeInheritance = false, - bool includeDependencies = false, - bool includeProperties = true, - bool includeFunctions = true, - int maxDepth = 1); + Task AnalyzeFileAsync(string filePath, AnalysisOptions? options = null); } diff --git a/src/ProjGraph.Lib.ClassDiagram/Application/UseCases/AnalyzeFileUseCase.cs b/src/ProjGraph.Lib.ClassDiagram/Application/UseCases/AnalyzeFileUseCase.cs index 93a72f8..46b9cd7 100644 --- a/src/ProjGraph.Lib.ClassDiagram/Application/UseCases/AnalyzeFileUseCase.cs +++ b/src/ProjGraph.Lib.ClassDiagram/Application/UseCases/AnalyzeFileUseCase.cs @@ -21,21 +21,15 @@ public class AnalyzeFileUseCase( /// Executes the analysis of a C# source file to extract class definitions and their relationships. /// /// The path to the C# source file to analyze. - /// Specifies whether to include inheritance relationships in the analysis. - /// Specifies whether to include dependency relationships in the analysis. - /// Specifies whether to include properties and fields in the analysis. - /// Specifies whether to include functions and methods in the analysis. - /// The maximum depth for analyzing relationships. + /// The analysis options. /// A task that represents the asynchronous operation. The task result contains the analyzed class model. /// Thrown when the specified source file is not found. public async Task ExecuteAsync( string filePath, - bool includeInheritance = false, - bool includeDependencies = false, - bool includeProperties = true, - bool includeFunctions = true, - int maxDepth = 1) + AnalysisOptions? options = null) { + options ??= new AnalysisOptions(); + if (!fileSystem.FileExists(filePath)) { throw new FileNotFoundException("Source file not found", filePath); @@ -58,15 +52,6 @@ public async Task ExecuteAsync( StartDirectory = startDir }; - var options = new AnalysisOptions - { - MaxDepth = maxDepth, - IncludeInheritance = includeInheritance, - IncludeDependencies = includeDependencies, - IncludeProperties = includeProperties, - IncludeFunctions = includeFunctions - }; - var typesToAnalyze = new Queue<(INamedTypeSymbol Symbol, int Depth)>(); await EnqueueInitialTypesAsync(syntaxTree, compilation, typesToAnalyze); diff --git a/src/ProjGraph.Mcp/Program.cs b/src/ProjGraph.Mcp/Program.cs index a4ee7e1..c1ca699 100644 --- a/src/ProjGraph.Mcp/Program.cs +++ b/src/ProjGraph.Mcp/Program.cs @@ -62,16 +62,8 @@ internal sealed class ProjGraphTools( public async Task GetClassDiagramAsync( [Description("Absolute path to the .cs file to analyze.")] string path, - [Description("Whether to search the workspace for base classes and interfaces.")] - bool includeInheritance = false, - [Description("Whether to search for and include other classes used as properties or fields.")] - bool includeDependencies = false, - [Description("Whether to display properties and fields in the class diagram (default: true).")] - bool includeProperties = true, - [Description("Whether to display functions/methods in the class diagram (default: true).")] - bool includeFunctions = true, - [Description("How many levels of relationships to follow (default: 1).")] - int depth = 1, + [Description("Analysis and discovery options.")] + AnalysisOptions? options = null, [Description("Whether to include the title in the diagram (default: true).")] bool showTitle = true, CancellationToken cancellationToken = default) @@ -86,13 +78,7 @@ public async Task GetClassDiagramAsync( FilePathGuard.RequireCsFile(path); - var model = await classService.AnalyzeFileAsync( - path, - includeInheritance, - includeDependencies, - includeProperties, - includeFunctions, - depth); + var model = await classService.AnalyzeFileAsync(path, options); return classRenderer.Render(model, new DiagramOptions(showTitle)); } diff --git a/tests/ProjGraph.Tests.Contract/McpClassDiagramTests.cs b/tests/ProjGraph.Tests.Contract/McpClassDiagramTests.cs index 2338fb9..5886709 100644 --- a/tests/ProjGraph.Tests.Contract/McpClassDiagramTests.cs +++ b/tests/ProjGraph.Tests.Contract/McpClassDiagramTests.cs @@ -1,5 +1,6 @@ using FluentAssertions; using ModelContextProtocol.Server; +using ProjGraph.Lib.ClassDiagram.Application; using ProjGraph.Mcp; using System.ComponentModel; using System.Reflection; @@ -43,35 +44,23 @@ public void GetClassDiagram_ShouldHave_RequiredParameters() pathParam.ParameterType.Should().Be(); pathParam.GetCustomAttribute().Should().NotBeNull(); - // Check optional flags - var inheritanceParam = parameters.Should().ContainSingle(p => p.Name == "includeInheritance").Which; - inheritanceParam.ParameterType.Should().Be(); - inheritanceParam.IsOptional.Should().BeTrue(); - inheritanceParam.DefaultValue.Should().Be(false); - - var dependenciesParam = parameters.Should().ContainSingle(p => p.Name == "includeDependencies").Which; - dependenciesParam.ParameterType.Should().Be(); - dependenciesParam.IsOptional.Should().BeTrue(); - dependenciesParam.DefaultValue.Should().Be(false); - - var propertiesParam = parameters.Should().ContainSingle(p => p.Name == "includeProperties").Which; - propertiesParam.ParameterType.Should().Be(); - propertiesParam.IsOptional.Should().BeTrue(); - propertiesParam.DefaultValue.Should().Be(true); - - var functionsParam = parameters.Should().ContainSingle(p => p.Name == "includeFunctions").Which; - functionsParam.ParameterType.Should().Be(); - functionsParam.IsOptional.Should().BeTrue(); - functionsParam.DefaultValue.Should().Be(true); - - var depthParam = parameters.Should().ContainSingle(p => p.Name == "depth").Which; - depthParam.ParameterType.Should().Be(); - depthParam.IsOptional.Should().BeTrue(); - depthParam.DefaultValue.Should().Be(1); + // Check options parameter + var optionsParam = parameters.Should().ContainSingle(p => p.Name == "options").Which; + optionsParam.ParameterType.Should().Be(); + optionsParam.IsOptional.Should().BeTrue(); + optionsParam.DefaultValue.Should().BeNull(); + optionsParam.GetCustomAttribute().Should().NotBeNull(); + // Check showTitle parameter var titleParam = parameters.Should().ContainSingle(p => p.Name == "showTitle").Which; titleParam.ParameterType.Should().Be(); titleParam.IsOptional.Should().BeTrue(); titleParam.DefaultValue.Should().Be(true); + titleParam.GetCustomAttribute().Should().NotBeNull(); + + // Check cancellationToken parameter + var ctParam = parameters.Should().ContainSingle(p => p.Name == "cancellationToken").Which; + ctParam.ParameterType.Should().Be(); + ctParam.IsOptional.Should().BeTrue(); } } diff --git a/tests/ProjGraph.Tests.Integration.Mcp/McpClassDiagramTests.cs b/tests/ProjGraph.Tests.Integration.Mcp/McpClassDiagramTests.cs index 868ab01..09c10a3 100644 --- a/tests/ProjGraph.Tests.Integration.Mcp/McpClassDiagramTests.cs +++ b/tests/ProjGraph.Tests.Integration.Mcp/McpClassDiagramTests.cs @@ -1,3 +1,4 @@ +using ProjGraph.Lib.ClassDiagram.Application; using ProjGraph.Mcp; using ProjGraph.Tests.Integration.Mcp.Helpers; using ProjGraph.Tests.Shared.Helpers; @@ -178,7 +179,8 @@ public async Task GetClassDiagram_WithInheritance_ShouldShowBaseClasses() var tools = CreateTools(); // Act - var result = await tools.GetClassDiagramAsync(_tempFileWithInheritance, true); + var result = + await tools.GetClassDiagramAsync(_tempFileWithInheritance, new AnalysisOptions(IncludeInheritance: true)); // Assert result.Should().Contain("class TestNamespace_Entity"); @@ -196,7 +198,8 @@ public async Task GetClassDiagram_WithInheritance_ShouldShowInterfaces() var tools = CreateTools(); // Act - var result = await tools.GetClassDiagramAsync(_tempFileWithInheritance, true); + var result = + await tools.GetClassDiagramAsync(_tempFileWithInheritance, new AnalysisOptions(IncludeInheritance: true)); // Assert result.Should().Contain("class TestNamespace_INameable"); @@ -228,7 +231,8 @@ public async Task GetClassDiagram_WithDependencies_ShouldShowRelatedClasses() var tools = CreateTools(); // Act - var result = await tools.GetClassDiagramAsync(_tempFileWithDependencies, includeDependencies: true); + var result = + await tools.GetClassDiagramAsync(_tempFileWithDependencies, new AnalysisOptions(IncludeDependencies: true)); // Assert result.Should().Contain("class TestNamespace_Customer"); @@ -244,7 +248,8 @@ public async Task GetClassDiagram_WithoutDependencies_ShouldNotShowRelatedClasse var tools = CreateTools(); // Act - var result = await tools.GetClassDiagramAsync(_tempFileWithDependencies, includeDependencies: false); + var result = await tools.GetClassDiagramAsync(_tempFileWithDependencies, + new AnalysisOptions(IncludeDependencies: false)); // Assert result.Should().Contain("class TestNamespace_Customer"); @@ -262,7 +267,8 @@ public async Task GetClassDiagram_WithDepth1_ShouldLimitRelationshipDepth() var tools = CreateTools(); // Act - var result = await tools.GetClassDiagramAsync(_tempFileWithDependencies, includeDependencies: true, depth: 1); + var result = await tools.GetClassDiagramAsync(_tempFileWithDependencies, + new AnalysisOptions(1, IncludeDependencies: true)); // Assert result.Should().NotStartWith("Error"); @@ -279,7 +285,8 @@ public async Task GetClassDiagram_WithDepth2_ShouldFollowDeeperRelationships() var tools = CreateTools(); // Act - var result = await tools.GetClassDiagramAsync(_tempFileWithDependencies, includeDependencies: true, depth: 2); + var result = await tools.GetClassDiagramAsync(_tempFileWithDependencies, + new AnalysisOptions(2, IncludeDependencies: true)); // Assert result.Should().NotStartWith("Error"); @@ -303,7 +310,7 @@ public async Task GetClassDiagram_RealProject_CoreModels_ShouldGenerateDiagram() } // Act - var result = await tools.GetClassDiagramAsync(modelsPath, true); + var result = await tools.GetClassDiagramAsync(modelsPath, new AnalysisOptions(IncludeInheritance: true)); // Assert result.Should().NotStartWith("Error"); @@ -320,11 +327,7 @@ public async Task GetClassDiagram_AllOptionsEnabled_ShouldWorkCorrectly() // Act var result = await tools.GetClassDiagramAsync( _tempFileWithInheritance, - true, - true, - true, - true, - 3); + new AnalysisOptions(3, true, true)); // Assert result.Should().NotStartWith("Error"); @@ -341,11 +344,7 @@ public async Task GetClassDiagram_AllOptionsDisabled_ShouldShowBasicClasses() // Act var result = await tools.GetClassDiagramAsync( _tempFileWithInheritance, - false, - false, - false, - false, - 0); + new AnalysisOptions(0, false, false, false, false)); // Assert result.Should().NotStartWith("Error"); @@ -361,7 +360,7 @@ public async Task GetClassDiagram_IncludePropertiesFalse_ShouldExcludeProperties var tools = CreateTools(); // Act - var result = await tools.GetClassDiagramAsync(_tempFile, includeProperties: false); + var result = await tools.GetClassDiagramAsync(_tempFile, new AnalysisOptions(IncludeProperties: false)); // Assert result.Should().NotContain("int Id"); @@ -380,7 +379,7 @@ public async Task GetClassDiagram_IncludeFunctionsFalse_ShouldExcludeMethods() await File.WriteAllTextAsync(path, "namespace Test; public class Svc { public void DoWork() {} }"); // Act - var result = await tools.GetClassDiagramAsync(path, includeFunctions: false); + var result = await tools.GetClassDiagramAsync(path, new AnalysisOptions(IncludeFunctions: false)); // Assert result.Should().NotContain("DoWork()"); @@ -396,10 +395,8 @@ public async Task GetClassDiagram_HiddenMembers_ShouldStillShowRelationships() // Hide both properties and functions, but enable inheritance and dependencies var result = await tools.GetClassDiagramAsync( _tempFileWithDependencies, - true, - true, - false, - false); + new AnalysisOptions(IncludeInheritance: true, IncludeDependencies: true, IncludeProperties: false, + IncludeFunctions: false)); // Assert result.Should().Contain("class TestNamespace_Customer"); @@ -460,9 +457,11 @@ public void M5() {} // Act var resultWithMembers = - await tools.GetClassDiagramAsync(complexFile, includeProperties: true, includeFunctions: true); + await tools.GetClassDiagramAsync(complexFile, + new AnalysisOptions(IncludeProperties: true, IncludeFunctions: true)); var resultWithoutMembers = - await tools.GetClassDiagramAsync(complexFile, includeProperties: false, includeFunctions: false); + await tools.GetClassDiagramAsync(complexFile, + new AnalysisOptions(IncludeProperties: false, IncludeFunctions: false)); // Assert var withCount = resultWithMembers.Length; diff --git a/tests/ProjGraph.Tests.Unit.ClassDiagram/AnalyzeFileUseCaseTests.cs b/tests/ProjGraph.Tests.Unit.ClassDiagram/AnalyzeFileUseCaseTests.cs index 7cb3cdb..d6a8f7c 100644 --- a/tests/ProjGraph.Tests.Unit.ClassDiagram/AnalyzeFileUseCaseTests.cs +++ b/tests/ProjGraph.Tests.Unit.ClassDiagram/AnalyzeFileUseCaseTests.cs @@ -79,7 +79,7 @@ public class Svc { } Arg.Any()) .ReturnsForAnyArgs(Task.CompletedTask); - await _sut.ExecuteAsync(filePath, false, true, true, false, 3); + await _sut.ExecuteAsync(filePath, new AnalysisOptions(3, false, true, true, false)); await _typeProcessor.Received(1).ProcessTypeQueueAsync( Arg.Any>(), diff --git a/tests/ProjGraph.Tests.Unit.ClassDiagram/ClassAnalysisDepthTests.cs b/tests/ProjGraph.Tests.Unit.ClassDiagram/ClassAnalysisDepthTests.cs index 4c8c0ee..ec2b82f 100644 --- a/tests/ProjGraph.Tests.Unit.ClassDiagram/ClassAnalysisDepthTests.cs +++ b/tests/ProjGraph.Tests.Unit.ClassDiagram/ClassAnalysisDepthTests.cs @@ -49,7 +49,7 @@ public async Task AnalyzeFileAsync_WithDepthLimit_DoesNotExceedDepth() await File.WriteAllTextAsync(fileC, "public class C {}"); // Depth 1: Should find A and B, but not C - var result = await _service.AnalyzeFileAsync(fileA, true); + var result = await _service.AnalyzeFileAsync(fileA, new AnalysisOptions(IncludeInheritance: true)); result.Types.Should().Contain(t => t.Name == "A"); result.Types.Should().Contain(t => t.Name == "B"); @@ -65,7 +65,7 @@ public async Task AnalyzeFileAsync_DepthZero_ReturnsOnlyRootType() await File.WriteAllTextAsync(fileA, "public class A : B {}"); await File.WriteAllTextAsync(fileB, "public class B {}"); - var result = await _service.AnalyzeFileAsync(fileA, true, maxDepth: 0); + var result = await _service.AnalyzeFileAsync(fileA, new AnalysisOptions(0, true)); result.Types.Should().Contain(t => t.Name == "A"); result.Types.Should().NotContain(t => t.Name == "B"); @@ -82,7 +82,7 @@ public async Task AnalyzeFileAsync_DepthTwo_TraversesFullChain() await File.WriteAllTextAsync(fileB, "public class B : C {}"); await File.WriteAllTextAsync(fileC, "public class C {}"); - var result = await _service.AnalyzeFileAsync(fileA, true, maxDepth: 2); + var result = await _service.AnalyzeFileAsync(fileA, new AnalysisOptions(2, true)); result.Types.Should().Contain(t => t.Name == "A"); result.Types.Should().Contain(t => t.Name == "B"); diff --git a/tests/ProjGraph.Tests.Unit.ClassDiagram/ClassAnalysisServiceTests.cs b/tests/ProjGraph.Tests.Unit.ClassDiagram/ClassAnalysisServiceTests.cs index cb54508..831e7a3 100644 --- a/tests/ProjGraph.Tests.Unit.ClassDiagram/ClassAnalysisServiceTests.cs +++ b/tests/ProjGraph.Tests.Unit.ClassDiagram/ClassAnalysisServiceTests.cs @@ -51,7 +51,7 @@ private void MyMethod() {} """; await File.WriteAllTextAsync(_tempFile, code); - var result = await _service.AnalyzeFileAsync(_tempFile, false); + var result = await _service.AnalyzeFileAsync(_tempFile); result.Types.Should().HaveCount(1); var type = result.Types[0]; @@ -70,7 +70,7 @@ public class MyGeneric {} """; await File.WriteAllTextAsync(_tempFile, code); - var result = await _service.AnalyzeFileAsync(_tempFile, false); + var result = await _service.AnalyzeFileAsync(_tempFile); result.Types.Should().HaveCount(1); var type = result.Types[0]; @@ -87,7 +87,7 @@ public class Derived : Base {} """; await File.WriteAllTextAsync(_tempFile, code); - var result = await _service.AnalyzeFileAsync(_tempFile, true); + var result = await _service.AnalyzeFileAsync(_tempFile, new AnalysisOptions(IncludeInheritance: true)); result.Types.Should().HaveCount(2); result.Relationships.Should().HaveCount(1); @@ -108,7 +108,7 @@ public async Task AnalyzeFileAsync_WithWorkspaceDiscovery_FindsRelatedType() await File.WriteAllTextAsync(modelFile, "public class Model {}"); await File.WriteAllTextAsync(Path.Combine(root, "Test.csproj"), ""); - var result = await _service.AnalyzeFileAsync(serviceFile, false, true); + var result = await _service.AnalyzeFileAsync(serviceFile, new AnalysisOptions(IncludeDependencies: true)); result.Types.Should().Contain(t => t.Name == "Service"); result.Types.Should().Contain(t => t.Name == "Model"); @@ -126,7 +126,7 @@ public class Derived : Base {} """; await File.WriteAllTextAsync(_tempFile, code); - var result = await _service.AnalyzeFileAsync(_tempFile, true); + var result = await _service.AnalyzeFileAsync(_tempFile, new AnalysisOptions(IncludeInheritance: true)); result.Types.Should().HaveCount(2); result.Relationships.Should().HaveCount(1); @@ -154,7 +154,7 @@ public class User : BaseEntity { public string Name { get; set; } } """); await File.WriteAllTextAsync(Path.Combine(root, "Test.csproj"), ""); - var result = await _service.AnalyzeFileAsync(userFile, true); + var result = await _service.AnalyzeFileAsync(userFile, new AnalysisOptions(IncludeInheritance: true)); result.Types.Count.Should().BeGreaterThanOrEqualTo(2); result.Relationships.Should().HaveCount(1); @@ -179,7 +179,7 @@ public enum Types """; await File.WriteAllTextAsync(_tempFile, code); - var result = await _service.AnalyzeFileAsync(_tempFile, false, true); + var result = await _service.AnalyzeFileAsync(_tempFile, new AnalysisOptions(IncludeDependencies: true)); result.Types.Should().HaveCount(1); var type = result.Types[0];