Skip to content

fix: validate verification and JSON arguments and treat throwing Times predicates as not met while waiting - #167

Merged
vbreuss merged 1 commit into
mainfrom
fix/negated-within-and-arguments
Oct 10, 2026
Merged

vbreuss merged 1 commit into
mainfrom
fix/negated-within-and-arguments

Conversation

@vbreuss

@vbreuss vbreuss commented Oct 10, 2026 •

Copy link
Copy Markdown
Member

Invalid counts, a missing predicate or interaction selector, and null or invalid expected JSON now fail where the caller passes them, with core's wording, instead of silently succeeding when negated, failing only during the evaluation or never matching.

A Times predicate receives the count, which further interactions change, so like core's repeated checks an exception counts as not met while the verification waits and only fails it when the last check still throws.

…s predicates as not met while waiting

Invalid counts, a missing predicate or interaction selector, and null or invalid expected JSON now fail where the caller passes them, with core's wording, instead of silently succeeding when negated, failing only during the evaluation or never matching.

A Times predicate receives the count, which further interactions change, so like core's repeated checks an exception counts as not met while the verification waits and only fails it when the last check still throws.
@vbreuss vbreuss self-assigned this Oct 10, 2026
Copilot AI balanced review requested due to automatic review settings October 10, 2026 08:07

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@sonarqubecloud

Copy link
Copy Markdown

@vbreuss vbreuss changed the title fix: validate verification and JSON arguments and treat throwing Time… fix: validate verification and JSON arguments and treat throwing Times predicates as not met while waiting Oct 10, 2026
@vbreuss
vbreuss enabled stacked auto-merge (squash) October 10, 2026 08:10
@vbreuss
vbreuss disabled stacked auto-merge October 10, 2026 08:25
@vbreuss
vbreuss added this pull request to stack #170 October 10, 2026 08:27
@github-actions

Copy link
Copy Markdown

Test Results

    8 files  ± 0      8 suites  ±0   1m 9s ⏱️ +4s
  297 tests +12    296 ✅ +12  1 💤 ±0  0 ❌ ±0 
2 000 runs  +82  1 999 ✅ +82  1 💤 ±0  0 ❌ ±0 

Results for commit 767c4e5. ± Comparison against base commit 6954156.

This pull request removes 4 and adds 16 tests. Note that renamed tests count towards both.
aweXpect.Mockolate.Tests.ThatVerificationResultIs+TimesTests ‑ WhenPredicateThrows_Within_ShouldFailWithoutWaiting
aweXpect.Mockolate.Tests.Web.ItExtensionsTests+HttpContentTests+IsJsonContentTests ‑ WithBody_ShouldCompareAsJson(body: "foo", expected: "bar", expectSuccess: False)
aweXpect.Mockolate.Tests.Web.ItExtensionsTests+HttpContentTests+IsJsonContentTests ‑ WithOptions_ShouldApplyOptions(body: "[1, 2,]", expected: "[1, 2,]", allowTrailingCommas: False)
aweXpect.Mockolate.Tests.Web.ItExtensionsTests+HttpContentTests+IsJsonContentTests ‑ WithOptions_ShouldApplyOptions(body: "[1, 2]", expected: "[1, 2,]", allowTrailingCommas: False)
aweXpect.Mockolate.Tests.ThatVerificationResultIs+AtLeastTests ‑ WhenTimesIsNegative_ShouldThrowArgumentOutOfRangeException
aweXpect.Mockolate.Tests.ThatVerificationResultIs+AtMost ‑ WhenTimesIsNegative_ShouldThrowArgumentOutOfRangeException
aweXpect.Mockolate.Tests.ThatVerificationResultIs+BetweenTests ‑ WhenMaximumIsLessThanMinimum_ShouldThrowArgumentOutOfRangeException
aweXpect.Mockolate.Tests.ThatVerificationResultIs+BetweenTests ‑ WhenMaximumIsNegative_ShouldThrowArgumentOutOfRangeException
aweXpect.Mockolate.Tests.ThatVerificationResultIs+BetweenTests ‑ WhenMinimumIsNegative_ShouldThrowArgumentOutOfRangeException
aweXpect.Mockolate.Tests.ThatVerificationResultIs+ExactlyTests ‑ WhenTimesIsNegative_ShouldThrowArgumentOutOfRangeException
aweXpect.Mockolate.Tests.ThatVerificationResultIs+ThenTests ‑ Then_WhenInteractionsAreNull_ShouldThrowArgumentNullException
aweXpect.Mockolate.Tests.ThatVerificationResultIs+TimesTests ‑ WhenPredicateIsNull_ShouldThrowArgumentNullException
aweXpect.Mockolate.Tests.ThatVerificationResultIs+TimesTests ‑ WhenPredicateStillThrowsAtTheEnd_WithTimeout_ShouldFail
aweXpect.Mockolate.Tests.ThatVerificationResultIs+TimesTests ‑ WhenPredicateStillThrowsAtTheEnd_Within_ShouldFail
…

@github-actions

Copy link
Copy Markdown

🚀 Benchmark Results

Details

BenchmarkDotNet v0.15.8, Linux Ubuntu 24.04.5 LTS (Noble Numbat)
AMD EPYC 7763 2.62GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 10.0.303
[Host] : .NET 10.0.12 (10.0.12, 10.0.1226.42308), X64 RyuJIT x86-64-v3
DefaultJob : .NET 10.0.12 (10.0.12, 10.0.1226.42308), X64 RyuJIT x86-64-v3

Method Mean Error StdDev Median Allocated
Dummy_aweXpect 0.0003 ns 0.0011 ns 0.0010 ns 0.0 ns -

@github-actions

Copy link
Copy Markdown

👽 Mutation Results

Mutation testing badge

aweXpect.Mockolate

Details
File Score Killed Survived Timeout No Coverage Ignored Compile Errors Runtime Errors Total Detected Total Undetected Total Mutants
ThatVerificationResult.AtLeast.cs 100.00% 5 0 0 0 2 0 0 5 0 7
ThatVerificationResult.AtMost.cs 100.00% 5 0 0 0 2 0 0 5 0 7
ThatVerificationResult.Between.cs 92.31% 36 3 0 0 9 24 0 36 3 72
ThatVerificationResult.cs 99.02% 94 1 7 0 30 72 0 101 1 204
ThatVerificationResult.Exactly.cs 100.00% 5 0 0 0 2 0 0 5 0 7
ThatVerificationResult.Then.cs 88.68% 47 6 0 0 14 23 0 47 6 90
ThatVerificationResult.Times.cs 100.00% 12 0 0 0 6 14 0 12 0 32
Web/ItExtensions.HttpContent.IsJsonContent.cs 91.84% 45 1 0 3 26 4 0 45 4 79

The final mutation score is 94.81%

Coverage Thresholds: high:80 low:60 break:0

@vbreuss
vbreuss merged commit ff6a029 into main Oct 10, 2026
16 checks passed
@vbreuss
vbreuss deleted the fix/negated-within-and-arguments branch October 10, 2026 08:50
@github-actions github-actions Bot added the state: released The issue is released label Oct 10, 2026
@github-actions

Copy link
Copy Markdown

This is addressed in release v3.3.0.

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

Labels

state: released The issue is released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants