Skip to content

Widen generated harness smoke test coverage#165

Merged
cwinland merged 3 commits intofeature/136-scenario-scaffold-implementationfrom
feature/123-full-test-generation-slice-1
May 6, 2026
Merged

Widen generated harness smoke test coverage#165
cwinland merged 3 commits intofeature/136-scenario-scaffold-implementationfrom
feature/123-full-test-generation-slice-1

Conversation

@cwinland
Copy link
Copy Markdown
Owner

@cwinland cwinland commented May 6, 2026

Summary

  • widen generated harness smoke tests for explicit generated harness partials to cover parameterless and typed optional-default public methods
  • support ValueTask and ValueTask<T> smoke-test execution, plus xUnit-availability gating and overload-binding coverage in analyzer tests
  • update the roadmap docs to describe the current narrow #123 slice and the remaining deferred generated-test scope

Validation

  • dotnet test c:\Users\chriswin\source\repos\FastMoq\FastMoq.sln
  • dotnet test c:\Users\chriswin\source\repos\FastMoq\FastMoq.Analyzers.Tests\FastMoq.Analyzers.Tests.csproj --filter GeneratedHarnessSourceGenerator
  • dotnet test c:\Users\chriswin\source\repos\FastMoq\FastMoq.Analyzers.Tests\FastMoq.Analyzers.Tests.csproj
  • dotnet build c:\Users\chriswin\source\repos\FastMoq\FastMoq.Generators\FastMoq.Generators.csproj
  • & 'c:\Users\chriswin\source\repos\FastMoq\scripts\Generate-ApiDocs.ps1'

Notes

Copilot AI review requested due to automatic review settings May 6, 2026 16:50
Copy link
Copy Markdown
Contributor

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 expands the generated-harness source generator to emit xUnit-gated “smoke tests” inside explicit MockerTestBase<TComponent> harness partials, covering parameterless and optional-default public instance methods (including Task/ValueTask return shapes). It also adds analyzer tests for these new behaviors and updates roadmap documentation to reflect the current narrowed #123 implementation slice.

Changes:

  • Emit xUnit Fact smoke tests (and skipped placeholders with reasons) within generated harness output when xUnit is available in the compilation.
  • Generate invocations for public instance methods that are safe to call with no parameters or compile-time optional defaults, including ValueTask/ValueTask<T> execution support.
  • Add analyzer tests for smoke test emission, overload binding via typed defaults, and “no xUnit reference” gating; update roadmap docs accordingly.

Reviewed changes

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

Show a summary per file
File Description
FastMoq.Generators/GeneratedHarnessSourceGenerator.cs Adds method discovery + optional-default argument formatting, xUnit availability gating, and smoke-test/placeholder emission into generated harness partials.
FastMoq.Analyzers.Tests/GeneratedHarnessSourceGeneratorTests.cs Adds tests validating generated smoke tests for parameterless/optional-default methods, overload binding, deferred placeholders, and xUnit-unavailable behavior.
FastMoq.Analyzers.Tests/AnalyzerTestHelpers.cs Adds an includeXunit toggle to allow generator tests to simulate compilations without xUnit references.
docs/roadmap/README.md Updates roadmap summary language to reflect the current explicit-harness xUnit smoke-test slice.
docs/roadmap/generator-roadmap.md Documents the current narrow generated-test slice and its supported/deferred boundaries.
docs/roadmap/generated-test-settings.md Updates baseline/design notes to account for the new xUnit-gated smoke-test slice as current generator-owned defaults.

Comment thread FastMoq.Generators/GeneratedHarnessSourceGenerator.cs
cwinland added 2 commits May 6, 2026 13:51
When component methods are named with C# keywords (e.g., @Class, @return),
the unescaped IMethodSymbol.Name resulted in invalid emitted code like
'component.class()' instead of 'component.@Class()'.

- Add EscapeIdentifierIfKeyword helper using SyntaxFacts.GetKeywordKind
- Apply escaping in CreateGeneratedTestMethodModel to all method references
- Add [Fact] test covering keyword methods (@Class, @interface, @return)

Addresses code review comment on GeneratedHarnessSourceGenerator.cs
… into generator pipeline (#123 slice 2) (#166)

Wire FastMoqGeneratedTestFramework MSBuild property into generator pipeline

- Add CompilerVisibleProperty for FastMoqGeneratedTestFramework to generator csproj
- Read build_property.FastMoqGeneratedTestFramework in incremental pipeline via AnalyzerConfigOptionsProvider
- Combine frameworkSetting with targets pipeline; pass to EmitSource
- When value is 'none' (case-insensitive), suppress xUnit smoke-test emission regardless of metadata
- Add TestAnalyzerConfigOptionsProvider / TestAnalyzerConfigOptions nested helpers for test isolation
- Add 3 new [Fact] tests covering none suppression, explicit xunit enable, and case-insensitive none

Part of #123
Copilot AI review requested due to automatic review settings May 6, 2026 18:08
@cwinland cwinland merged commit a69f67c into feature/136-scenario-scaffold-implementation May 6, 2026
4 checks passed
cwinland added a commit that referenced this pull request May 6, 2026
* Expand generated scenario scaffold executors

* Add generated shared setup scaffold hooks

* Strengthen generated shared setup hook ordering test

* Document generated scenario scaffold members

* docs: align generator roadmap with current scope

* Widen generated harness smoke test coverage (#165)

* Widen generated harness smoke test coverage

* Fix: Escape C# keywords in generated method invocations

When component methods are named with C# keywords (e.g., @Class, @return),
the unescaped IMethodSymbol.Name resulted in invalid emitted code like
'component.class()' instead of 'component.@Class()'.

- Add EscapeIdentifierIfKeyword helper using SyntaxFacts.GetKeywordKind
- Apply escaping in CreateGeneratedTestMethodModel to all method references
- Add [Fact] test covering keyword methods (@Class, @interface, @return)

Addresses code review comment on GeneratedHarnessSourceGenerator.cs

* feat(generators): wire FastMoqGeneratedTestFramework MSBuild property into generator pipeline (#123 slice 2) (#166)

Wire FastMoqGeneratedTestFramework MSBuild property into generator pipeline

- Add CompilerVisibleProperty for FastMoqGeneratedTestFramework to generator csproj
- Read build_property.FastMoqGeneratedTestFramework in incremental pipeline via AnalyzerConfigOptionsProvider
- Combine frameworkSetting with targets pipeline; pass to EmitSource
- When value is 'none' (case-insensitive), suppress xUnit smoke-test emission regardless of metadata
- Add TestAnalyzerConfigOptionsProvider / TestAnalyzerConfigOptions nested helpers for test isolation
- Add 3 new [Fact] tests covering none suppression, explicit xunit enable, and case-insensitive none

Part of #123
cwinland added a commit that referenced this pull request May 6, 2026
* Document generated-test settings design for #162

* Fix generated harness parameterless constructor selection

* Define #126 scenario scaffolding contract

* Document #134 helper-family narrowing matrix

* Align generator project GUID across solutions

* Add generated shared setup scenario scaffold hooks (#164)

* Expand generated scenario scaffold executors

* Add generated shared setup scaffold hooks

* Strengthen generated shared setup hook ordering test

* Document generated scenario scaffold members

* docs: align generator roadmap with current scope

* Widen generated harness smoke test coverage (#165)

* Widen generated harness smoke test coverage

* Fix: Escape C# keywords in generated method invocations

When component methods are named with C# keywords (e.g., @Class, @return),
the unescaped IMethodSymbol.Name resulted in invalid emitted code like
'component.class()' instead of 'component.@Class()'.

- Add EscapeIdentifierIfKeyword helper using SyntaxFacts.GetKeywordKind
- Apply escaping in CreateGeneratedTestMethodModel to all method references
- Add [Fact] test covering keyword methods (@Class, @interface, @return)

Addresses code review comment on GeneratedHarnessSourceGenerator.cs

* feat(generators): wire FastMoqGeneratedTestFramework MSBuild property into generator pipeline (#123 slice 2) (#166)

Wire FastMoqGeneratedTestFramework MSBuild property into generator pipeline

- Add CompilerVisibleProperty for FastMoqGeneratedTestFramework to generator csproj
- Read build_property.FastMoqGeneratedTestFramework in incremental pipeline via AnalyzerConfigOptionsProvider
- Combine frameworkSetting with targets pipeline; pass to EmitSource
- When value is 'none' (case-insensitive), suppress xUnit smoke-test emission regardless of metadata
- Add TestAnalyzerConfigOptionsProvider / TestAnalyzerConfigOptions nested helpers for test isolation
- Add 3 new [Fact] tests covering none suppression, explicit xunit enable, and case-insensitive none

Part of #123
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants