Skip to content

[repo-assist] chore: remove Moq test dependency#194

Merged
NichUK merged 1 commit into
developfrom
repo-assist/eng-remove-moq-2026-06-18-5d62c5dfaede4e6c
Jun 18, 2026
Merged

[repo-assist] chore: remove Moq test dependency#194
NichUK merged 1 commit into
developfrom
repo-assist/eng-remove-moq-2026-06-18-5d62c5dfaede4e6c

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

🤖 This is an automated PR from Repo Assist.

What

Removes the Moq (v4.20.72) package from the test project. It was used in exactly one test to stub an IFormatProvider — a case that doesn't warrant a full mocking framework.

Changes

  • tests/FixedPointNano.Tests/FixedPointNano.Tests.csproj: remove Moq PackageReference
  • tests/FixedPointNano.Tests/FixedPointNanoTests.cs:
    • Remove using Moq;
    • Add TrackingFormatProvider — a 12-line private helper that implements IFormatProvider and counts how many times GetFormat is called
    • Replace Mock<IFormatProvider> + provider.Object with new TrackingFormatProvider(numberFormat)
    • Replace provider.Verify(...) with Assert.That(provider.GetFormatCallCount, Is.GreaterThan(0))

Why

Moq brings in Castle.Core and other transitive dependencies. For a numeric library test project, it is disproportionate overhead for a single trivial stub. The replacement helper is self-contained, easier to read, and removes roughly 3 MB of transitive assemblies from the test build.

Test Status

✅ Build succeeded (dotnet build -c Release, 0 warnings, 0 errors).
✅ All 1437 tests pass.

Generated by 🌈 Repo Assist, see workflow run. Learn more.

Add this agentic workflows to your repo

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@e15e57b40918dbca11b350c55d02ab61934afa75

Moq was used in exactly one test (ToStringAndTryFormatShouldUse-
ProvidedFormatProvider) solely to stub a trivial IFormatProvider.
Replace it with a lightweight private TrackingFormatProvider helper
that returns the configured NumberFormatInfo and records call count.

This eliminates a transitive dependency on Castle.Core and any other
Moq internals from the test project, reducing the dependency surface
without any loss of test coverage.

All 1437 tests pass; 0 warnings, 0 errors.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@NichUK NichUK marked this pull request as ready for review June 18, 2026 17:45
Copilot AI review requested due to automatic review settings June 18, 2026 17:45

Copilot AI left a comment

Copy link
Copy Markdown

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 removes the Moq dependency from the test project by replacing its single use (mocking an IFormatProvider) with a small, self-contained TrackingFormatProvider helper. This keeps the test intent intact while reducing transitive dependencies in FixedPointNano’s test suite.

Changes:

  • Removed Moq PackageReference from the test project.
  • Replaced Mock<IFormatProvider> usage in ToStringAndTryFormatShouldUseProvidedFormatProvider() with a lightweight TrackingFormatProvider.
  • Updated the assertion from a Moq verification to a simple call-count assertion on the helper.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
tests/FixedPointNano.Tests/FixedPointNanoTests.cs Removes Moq usage and adds a small IFormatProvider test helper to keep coverage of provider-based formatting.
tests/FixedPointNano.Tests/FixedPointNano.Tests.csproj Removes the Moq dependency from the test project.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@NichUK NichUK merged commit d166585 into develop Jun 18, 2026
9 checks passed
@NichUK NichUK deleted the repo-assist/eng-remove-moq-2026-06-18-5d62c5dfaede4e6c branch June 18, 2026 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants