Skip to content

Conversation

@vbreuss
Copy link
Contributor

@vbreuss vbreuss commented Oct 3, 2025

This PR adds support for inherited interfaces in the Mockerade source generator, allowing it to generate mocks for types that implement multiple interfaces or inherit from other interfaces.

Key changes:

  • Enhanced type traversal to include all base types and interfaces when collecting mockable members
  • Added explicit interface implementation support for handling method name conflicts
  • Extended indexer property support with parameter handling

@vbreuss vbreuss self-assigned this Oct 3, 2025
Copilot AI review requested due to automatic review settings October 3, 2025 20:22
@vbreuss vbreuss added the enhancement New feature or request label Oct 3, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for inherited interfaces in the Mockerade source generator, allowing it to generate mocks for types that implement multiple interfaces or inherit from other interfaces.

Key changes:

  • Enhanced type traversal to include all base types and interfaces when collecting mockable members
  • Added explicit interface implementation support for handling method name conflicts
  • Extended indexer property support with parameter handling

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
Tests/Mockerade.SourceGenerators.Tests/Test.cs Added test case for IList mock generation to verify inherited interface support
Source/Mockerade.SourceGenerators/Internals/SourceGeneration.MockClass.cs Updated mock class generation to handle indexer properties and explicit interface implementations
Source/Mockerade.SourceGenerators/Internals/SourceGeneration.ExtensionsClass.cs Modified extension method generation to exclude explicit implementations and indexers from certain operations
Source/Mockerade.SourceGenerators/Internals/GeneratorHelpers.cs Refined mock detection logic and added type validation
Source/Mockerade.SourceGenerators/Entities/Type.cs Added null safety for namespace handling
Source/Mockerade.SourceGenerators/Entities/Property.cs Added indexer detection and parameter support
Source/Mockerade.SourceGenerators/Entities/Method.cs Added explicit implementation tracking and containing type information
Source/Mockerade.SourceGenerators/Entities/Class.cs Implemented comprehensive type hierarchy traversal and duplicate method handling

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings October 3, 2025 20:24
@vbreuss vbreuss enabled auto-merge (squash) October 3, 2025 20:25
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Oct 3, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@github-actions
Copy link

github-actions bot commented Oct 3, 2025

🚀 Benchmark Results

Details

BenchmarkDotNet v0.14.0, Ubuntu 24.04.3 LTS (Noble Numbat)
AMD EPYC 7763, 1 CPU, 4 logical and 2 physical cores
.NET SDK 10.0.100-rc.1.25451.107
[Host] : .NET 10.0.0 (10.0.25.45207), X64 RyuJIT AVX2

Job=InProcess Toolchain=InProcessEmitToolchain IterationCount=15
LaunchCount=1 WarmupCount=10

Method Mean Error StdDev Gen0 Gen1 Allocated
Simple_Mockerade 1.048 μs 0.0200 μs 0.0187 μs 0.1469 - 2.41 KB
Simple_Moq 184.228 μs 1.4645 μs 1.2230 μs 0.4883 - 14.71 KB
Simple_NSubstitute 5.855 μs 0.0846 μs 0.0791 μs 0.5569 0.0076 9.14 KB
Simple_FakeItEasy 6.363 μs 0.0631 μs 0.0590 μs 0.4959 - 8.11 KB

@github-actions
Copy link

github-actions bot commented Oct 3, 2025

👽 Mutation Results

Mockerade

Details
File Score Killed Survived Timeout No Coverage Ignored Compile Errors Total Detected Total Undetected Total Mutants

The final mutation score is NaN%

Coverage Thresholds: high:80 low:60 break:0

@github-actions
Copy link

github-actions bot commented Oct 3, 2025

Test Results

    8 files  ±0      8 suites  ±0   10s ⏱️ ±0s
  405 tests ±0    404 ✅ ±0  1 💤 ±0  0 ❌ ±0 
2 797 runs  ±0  2 796 ✅ ±0  1 💤 ±0  0 ❌ ±0 

Results for commit e79ee07. ± Comparison against base commit c4b045b.

@vbreuss vbreuss merged commit 670d8d5 into main Oct 3, 2025
9 of 10 checks passed
@vbreuss vbreuss deleted the topic/support-generic-types branch October 3, 2025 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants