[repo-assist] chore: remove Moq test dependency#194
Merged
NichUK merged 1 commit intoJun 18, 2026
Conversation
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>
There was a problem hiding this comment.
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
MoqPackageReferencefrom the test project. - Replaced
Mock<IFormatProvider>usage inToStringAndTryFormatShouldUseProvidedFormatProvider()with a lightweightTrackingFormatProvider. - 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 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 anIFormatProvider— a case that doesn't warrant a full mocking framework.Changes
tests/FixedPointNano.Tests/FixedPointNano.Tests.csproj: removeMoqPackageReferencetests/FixedPointNano.Tests/FixedPointNanoTests.cs:using Moq;TrackingFormatProvider— a 12-line private helper that implementsIFormatProviderand counts how many timesGetFormatis calledMock<IFormatProvider>+provider.Objectwithnew TrackingFormatProvider(numberFormat)provider.Verify(...)withAssert.That(provider.GetFormatCallCount, Is.GreaterThan(0))Why
Moqbrings inCastle.Coreand 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.
Add this agentic workflows to your repo
To install this agentic workflow, run