Skip to content

coverage: add missing analyzer tests#399

Merged
vbreuss merged 1 commit into
mainfrom
topic/improve-analyzer-coverage
Jan 24, 2026
Merged

coverage: add missing analyzer tests#399
vbreuss merged 1 commit into
mainfrom
topic/improve-analyzer-coverage

Conversation

@vbreuss
Copy link
Copy Markdown
Member

@vbreuss vbreuss commented Jan 24, 2026

This PR adds missing test coverage for the Mockolate analyzers, specifically for the WrappabilityAnalyzer and MockabilityAnalyzer.

Key Changes:

  • Added test for wrapping generic interfaces to ensure no false positives
  • Added test for mocking arrays to verify proper error reporting
  • Added test for mock generators without attributes to ensure they're not flagged
  • Removed dead code checking for static types in MockabilityAnalyzer

@vbreuss vbreuss self-assigned this Jan 24, 2026
@vbreuss vbreuss added the coverage Additional tests for edge cases or improvement of test coverage label Jan 24, 2026
Copilot AI review requested due to automatic review settings January 24, 2026 20:42
Copy link
Copy Markdown

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 missing test coverage for the Mockolate analyzers, specifically for the WrappabilityAnalyzer and MockabilityAnalyzer. The tests ensure that generic interfaces can be wrapped and that arrays are properly flagged as unmockable.

Changes:

  • Added test for wrapping generic interfaces to ensure no false positives
  • Added test for mocking arrays to verify proper error reporting
  • Added test for mock generators without attributes to ensure they're not flagged
  • Removed dead code checking for static types in MockabilityAnalyzer

Reviewed changes

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

File Description
Tests/Mockolate.Analyzers.Tests/WrappabilityAnalyzerTests.cs Adds test coverage for wrapping generic interfaces
Tests/Mockolate.Analyzers.Tests/MockabilityAnalyzerTests.cs Adds tests for array mocking, global interfaces in namespaces, and mock generators without attributes
Source/Mockolate.Analyzers/MockabilityAnalyzer.cs Removes unreachable static type check since arrays are handled earlier

Comment thread Tests/Mockolate.Analyzers.Tests/MockabilityAnalyzerTests.cs Outdated
@vbreuss vbreuss force-pushed the topic/improve-analyzer-coverage branch from 5015bea to 541b529 Compare January 24, 2026 20:44
@vbreuss vbreuss enabled auto-merge (squash) January 24, 2026 20:44
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jan 24, 2026

🚀 Benchmark Results

Details

BenchmarkDotNet v0.15.8, Linux Ubuntu 24.04.3 LTS (Noble Numbat)
AMD EPYC 7763 3.12GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 10.0.102
[Host] : .NET 10.0.2 (10.0.2, 10.0.225.61305), X64 RyuJIT x86-64-v3

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

Method Mean Error StdDev Gen0 Gen1 Allocated
Simple_Mockolate 1.559 μs 0.0347 μs 0.0290 μs 0.2270 - 3.73 KB
Simple_Moq 181.357 μs 0.5025 μs 0.4196 μs 0.4883 - 14.55 KB
Simple_NSubstitute 5.993 μs 0.0374 μs 0.0350 μs 0.5569 0.0076 9.14 KB
Simple_FakeItEasy 6.779 μs 0.0291 μs 0.0258 μs 0.4959 - 8.11 KB

@sonarqubecloud
Copy link
Copy Markdown

@github-actions
Copy link
Copy Markdown

Test Results

    21 files  ±0      21 suites  ±0   6m 57s ⏱️ + 1m 36s
 2 377 tests +3   2 376 ✅ +3  1 💤 ±0  0 ❌ ±0 
15 932 runs  +9  15 931 ✅ +9  1 💤 ±0  0 ❌ ±0 

Results for commit 541b529. ± Comparison against base commit 07bd5d9.

@vbreuss vbreuss merged commit 198f8cb into main Jan 24, 2026
12 checks passed
@vbreuss vbreuss deleted the topic/improve-analyzer-coverage branch January 24, 2026 20:50
@github-actions
Copy link
Copy Markdown

This is addressed in release v1.0.3.

@github-actions github-actions Bot added the state: released The issue is released label Jan 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

coverage Additional tests for edge cases or improvement of test coverage state: released The issue is released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants