Add Peek.Common unit tests (MathHelper, PathHelper)#49105
Open
crutkas wants to merge 1 commit into
Open
Conversation
Adds a Peek.Common.UnitTests project (MSTest) covering MathHelper.Modulo / NumberOfDigits and PathHelper.IsUncPath, including negative-dividend, boundary, UNC, drive-letter, URI, and empty/null edge cases. Adds an argument guard to MathHelper.Modulo so a non-positive divisor throws instead of silently dividing by zero, and registers the test project in PowerToys.slnx. Tests-only split of #46684 (Peek portion), without the bundled global dependency bump. 37 tests pass. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
jiripolasek
reviewed
Jul 3, 2026
| /// Why: Baseline positive case — the most common UNC format | ||
| /// </summary> | ||
| [TestMethod] | ||
| public void IsUncPath_StandardUncPath_ShouldReturnTrue() |
Collaborator
There was a problem hiding this comment.
[nit] A data-driven unit test would be more compact.
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
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.
Summary
Adds a Peek.Common.UnitTests project (MSTest) with unit coverage for Peek.Common.Helpers:
Also adds a small correctness guard to MathHelper.Modulo: a non-positive divisor now throws ArgumentOutOfRangeException instead of silently throwing DivideByZeroException (b == 0) or returning a misleading result (b < 0). Registers the test project in
PowerToys.slnx(ARM64 + x64).37 tests pass locally (x64 Debug).
Context
This is a clean, tests-only split of #46684 (the Peek.Common portion), intentionally without the bundled global dependency bump from that PR. The PowerAccent.Core portion of #46684 was shipped separately in #49104.
Test coverage
No production behavior changes beyond the Modulo argument guard, which is covered by the new tests.