Skip to content

feat!: replace ITimeSystem with TimeProvider - #2148

Merged
vbreuss merged 2 commits into
mainfrom
feat/time-provider
Oct 28, 2026
Merged

vbreuss merged 2 commits into
mainfrom
feat/time-provider

Conversation

@vbreuss

@vbreuss vbreuss commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

The clock of an evaluation was the custom ITimeSystem in aweXpect.Core.Internal, experimental behind the diagnostic aweXpect5001. It is now the standard System.TimeProvider, so a test can pass the clock it already uses, e.g. the FakeTimeProvider of Microsoft.Extensions.TimeProvider.Testing, and share it with the code under test instead of writing an adapter.

WithTimeProvider(timeProvider) in the namespace aweXpect.Core replaces WithTimeSystem(timeSystem). As it only takes a standard type, it is stable public API and no longer experimental; it still applies to every expectation combined in Expect.ThatAll or Expect.ThatAny. TimeProvider.System is the default and keeps the waits and timeouts of the real clock unchanged: it still uses Task.Delay and CancellationTokenSource.CancelAfter directly. Any other provider gets a timer from CreateTimer with the exact delay on every target framework, also for an infinite wait.

Extensions that wait for something outside aweXpect with a timeout of their own, e.g. a mock that waits for an interaction Within(timeout), could only cancel their wait with CancelAfter on the real clock, while GetTimestamp and GetElapsedTime of the evaluation context measured on the evaluation clock. On a virtual clock the timeout elapsed in real time and HasWaitElapsed compared it with virtual time. The new CancelAfter of IEvaluationContext cancels on the clock of the evaluation, so the timeout and the measured time agree.

The test helper VirtualTimeSystem is now the TimeProvider VirtualTimeProvider with the same semantics: a timer whose state is a CancellationTokenSource is a scheduled cancellation, every other timer is a wait.

BREAKING CHANGE: WithTimeSystem(…) and ITimeSystem are removed; use WithTimeProvider(…) with a TimeProvider instead. The diagnostic aweXpect5001 no longer exists. aweXpect.Core depends on Microsoft.Bcl.TimeProvider for netstandard2.0.

The clock of an evaluation was the custom `ITimeSystem` in `aweXpect.Core.Internal`, experimental behind the diagnostic `aweXpect5001`. It is now the standard `System.TimeProvider`, so a test can pass the clock it already uses, e.g. the `FakeTimeProvider` of `Microsoft.Extensions.TimeProvider.Testing`, and share it with the code under test instead of writing an adapter.

`WithTimeProvider(timeProvider)` in the namespace `aweXpect` replaces `WithTimeSystem(timeSystem)`. As it only takes a standard type, it is stable public API and no longer experimental; it still applies to every expectation combined in `Expect.ThatAll` or `Expect.ThatAny`. `TimeProvider.System` is the default and keeps the waits and timeouts of the real clock unchanged: it still uses `Task.Delay` and `CancellationTokenSource.CancelAfter` directly. Any other provider gets a timer from `CreateTimer` with the exact delay on every target framework, also for an infinite wait.

Extensions that wait for something outside aweXpect with a timeout of their own, e.g. a mock that waits for an interaction `Within(timeout)`, could only cancel their wait with `CancelAfter` on the real clock, while `GetTimestamp` and `GetElapsedTime` of the evaluation context measured on the evaluation clock. On a virtual clock the timeout elapsed in real time and `HasWaitElapsed` compared it with virtual time. The new `CancelAfter` of `IEvaluationContext` cancels on the clock of the evaluation, so the timeout and the measured time agree.

The test helper `VirtualTimeSystem` is now the `TimeProvider` `VirtualTimeProvider` with the same semantics: a timer whose state is a `CancellationTokenSource` is a scheduled cancellation, every other timer is a wait.

BREAKING CHANGE: `WithTimeSystem(…)` and `ITimeSystem` are removed; use `WithTimeProvider(…)` with a `TimeProvider` instead. The diagnostic `aweXpect5001` no longer exists. `aweXpect.Core` depends on `Microsoft.Bcl.TimeProvider` for `netstandard2.0`.
@vbreuss vbreuss self-assigned this Oct 28, 2026
`WithTimeProvider(…)` is an extension method on every expectation. In the namespace `aweXpect`, which every test imports for `Expect.That`, it showed up on every result although only tests that run on a virtual clock need it. In `aweXpect.Core`, the namespace of `Expectation`, it only shows up where the test imports it.
@vbreuss
vbreuss merged commit f843555 into main Oct 28, 2026
15 checks passed
@vbreuss
vbreuss deleted the feat/time-provider branch October 28, 2026 19:40
@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Benchmarks

Compared to main: memory to the latest run, time to the median of the last 10 runs, as the runners differ in speed. A relative change marks when aweXpect gets more than 15% faster or slower relative to FluentAssertions and TUnit: 🔴 / 🟢 against both of them, 🔸 / 🔹 against only one.

aweXpect

Compared to main @​ 19fa288e

Relative performance (how many times as long the other library takes as aweXpect, main → PR)

Benchmark vs FluentAssertions vs TUnit
EventTriggered 123.2× → 86.1× 🔸 +43%
Satisfies 217.1× → 138.8× 🔸 +56% 1.74× → 1.74×
StringArrayInAnyOrder 37.2× → 30.2× 🔸 +23% 1.12× → 1.18×
All benchmarks compared to main
Benchmark Time Memory vs FluentAssertions vs TUnit
Contains 290.7 ns → 159.7 ns (-45%) 480 B → 480 B 1.34× → 1.37× 1.40× → 1.43×
Equivalency 10.63 μs → 5.74 μs (-46%) 1,968 B → 1,968 B 34.6× → 35.5× 1.86× → 1.91×
EventTriggered 642.4 ns → 371.2 ns (-42%) 1,488 B → 1,488 B 123.2× → 86.1× 🔸 +43%
Int_GreaterThan 103.7 ns → 61.4 ns (-41%) 272 B → 272 B 2.47× → 2.47× 2.33× → 2.31×
ItemsCount_AtLeast 224.2 ns → 123.0 ns (-45%) 384 B → 384 B 2.31× → 2.41× 1.72× → 1.84×
Multiple 713.8 ns → 416.9 ns (-42%) 1,232 B → 1,232 B 2.69× → 2.89× 1.31× → 1.32×
Satisfies 141.6 ns → 83.2 ns (-41%) 304 B → 304 B 217.1× → 138.8× 🔸 +56% 1.74× → 1.74×
String 209.2 ns → 128.5 ns (-39%) 344 B → 344 B 2.53× → 2.42× 1.62× → 1.63×
StringArray 698.5 ns → 397.5 ns (-43%) 632 B → 632 B 2.01× → 2.04× 0.95× → 0.98×
StringArrayInAnyOrder 702.5 ns → 396.5 ns (-44%) 680 B → 680 B 37.2× → 30.2× 🔸 +23% 1.12× → 1.18×
Throws 11.90 μs → 6.36 μs (-47%) 1,720 B → 1,720 B 3.29× → 3.08× 0.89× → 0.97×
ThrowsAsync 11.50 μs → 5.94 μs (-48%) 2,200 B → 2,200 B 5.01× → 4.88× 1.82× → 1.99×
Raw results
BenchmarkDotNet v0.15.8, Linux Ubuntu 26.04.1 LTS (Resolute Raccoon)
AMD EPYC 9V45 2.60GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 10.0.303
  [Host] : .NET 8.0.33 (8.0.33, 8.0.3326.52219), X64 RyuJIT x86-64-v4

Job=InProcess  Toolchain=InProcessEmitToolchain  IterationCount=15  
LaunchCount=1  WarmupCount=10  

Method Mean vs aweXpect Error StdDev Gen0 Gen1 Allocated vs aweXpect
Contains_aweXpect 159.75 ns 3.552 ns 3.149 ns 0.0286 - 480 B
Contains_FluentAssertions 219.35 ns +37% 6.198 ns 5.494 ns 0.0961 0.0002 1608 B +235%
Contains_TUnit 228.93 ns +43% 5.063 ns 4.488 ns 0.0505 - 848 B +77%
Equivalency_aweXpect 5,739.69 ns 63.906 ns 53.364 ns 0.1144 - 1968 B
Equivalency_FluentAssertions 203,832.56 ns +3451% 2,424.177 ns 2,267.577 ns 35.1563 1.9531 590288 B +29894%
Equivalency_TUnit 10,967.79 ns +91% 189.184 ns 157.977 ns 0.9308 - 15680 B +697%
EventTriggered_aweXpect 371.20 ns 5.026 ns 4.701 ns 0.0887 - 1488 B
EventTriggered_FluentAssertions 31,946.95 ns +8506% 1,663.937 ns 1,556.448 ns 0.3052 0.2441 5256 B +253%
Int_GreaterThan_aweXpect 61.37 ns 1.260 ns 1.117 ns 0.0162 - 272 B
Int_GreaterThan_FluentAssertions 151.44 ns +147% 3.124 ns 2.769 ns 0.0730 - 1224 B +350%
Int_GreaterThan_TUnit 141.63 ns +131% 2.446 ns 2.043 ns 0.0463 - 776 B +185%
ItemsCount_AtLeast_aweXpect 123.01 ns 3.135 ns 2.933 ns 0.0229 - 384 B
ItemsCount_AtLeast_FluentAssertions 296.33 ns +141% 5.371 ns 5.024 ns 0.1197 - 2008 B +423%
ItemsCount_AtLeast_TUnit 226.28 ns +84% 8.438 ns 7.480 ns 0.0634 - 1064 B +177%
Multiple_aweXpect 416.90 ns 7.331 ns 6.857 ns 0.0734 - 1232 B
Multiple_FluentAssertions 1,203.86 ns +189% 46.687 ns 43.672 ns 0.4025 - 6744 B +447%
Multiple_TUnit 552.24 ns +32% 7.196 ns 5.618 ns 0.1335 - 2240 B +82%
Satisfies_aweXpect 83.24 ns 1.845 ns 1.636 ns 0.0181 - 304 B
Satisfies_FluentAssertions 11,555.74 ns +13783% 230.320 ns 204.173 ns 0.3357 0.2899 5615 B +1747%
Satisfies_TUnit 144.88 ns +74% 4.231 ns 3.750 ns 0.0424 - 712 B +134%
String_aweXpect 128.48 ns 1.394 ns 1.304 ns 0.0205 - 344 B
String_FluentAssertions 310.93 ns +142% 5.203 ns 4.062 ns 0.1373 - 2304 B +570%
String_TUnit 208.93 ns +63% 2.888 ns 2.255 ns 0.0544 - 912 B +165%
StringArray_aweXpect 397.54 ns 9.010 ns 8.428 ns 0.0377 - 632 B
StringArray_FluentAssertions 810.39 ns +104% 17.537 ns 16.404 ns 0.2480 - 4152 B +557%
StringArray_TUnit 388.24 ns -2% 16.151 ns 15.108 ns 0.0753 - 1264 B +100%
StringArrayInAnyOrder_aweXpect 396.51 ns 7.150 ns 5.971 ns 0.0405 - 680 B
StringArrayInAnyOrder_FluentAssertions 11,973.96 ns +2920% 321.634 ns 300.857 ns 1.9989 0.0610 33471 B +4822%
StringArrayInAnyOrder_TUnit 469.78 ns +18% 14.351 ns 13.424 ns 0.0839 - 1408 B +107%
Throws_aweXpect 6,358.69 ns 71.732 ns 56.004 ns 0.0992 - 1720 B
Throws_FluentAssertions 19,560.42 ns +208% 370.956 ns 346.993 ns 1.0986 - 18609 B +982%
Throws_TUnit 6,146.58 ns -3% 195.027 ns 182.428 ns 0.1068 - 1824 B +6%
ThrowsAsync_aweXpect 5,942.15 ns 131.366 ns 109.697 ns 0.1297 - 2200 B
ThrowsAsync_FluentAssertions 29,005.42 ns +388% 463.335 ns 410.734 ns 1.4038 - 23553 B +971%
ThrowsAsync_TUnit 11,796.25 ns +99% 96.098 ns 75.027 ns 0.1678 - 2920 B +33%

aweXpect.Json

Compared to main @​ 19fa288e

Relative performance (how many times as long the other library takes as aweXpect, main → PR)

Benchmark vs FluentAssertions
JsonArrayElements 8.51× → 6.58× 🔸 +29%
JsonNestedPropertyChain 0.53× → 0.44× 🔸 +21%
JsonString 7.50× → 6.44× 🔸 +16%
All benchmarks compared to main
Benchmark Time Memory vs FluentAssertions
JsonArrayElements 5.07 μs → 3.20 μs (-37%) 3,704 B → 3,704 B 8.51× → 6.58× 🔸 +29%
JsonArrayInAnyOrder 9.63 μs → 5.42 μs (-44%) 6,936 B → 6,936 B 29.1× → 29.9×
JsonEquality 2.90 μs → 1.69 μs (-42%) 1,296 B → 1,296 B 0.70× → 0.67×
JsonNestedPropertyChain 2.24 μs → 1.39 μs (-38%) 3,072 B → 3,072 B 0.53× → 0.44× 🔸 +21%
JsonProperty 2.81 μs → 1.68 μs (-40%) 2,904 B → 2,904 B 0.66× → 0.59×
JsonPropertyChain 3.04 μs → 1.79 μs (-41%) 3,872 B → 3,872 B 0.45× → 0.40×
JsonString 2.04 μs → 1.20 μs (-41%) 1,136 B → 1,136 B 7.50× → 6.44× 🔸 +16%
JsonStringCollection 165.31 μs → 99.66 μs (-40%) 67,664 B → 67,664 B 1.18× → 1.16×
JsonStringExpectations 2.65 μs → 1.55 μs (-41%) 2,400 B → 2,400 B 0.73× → 0.69×
ParsedJson 1.60 μs → 985.5 ns (-39%) 1,112 B → 1,112 B 8.59× → 8.08×
Raw results
BenchmarkDotNet v0.15.8, Linux Ubuntu 26.04.1 LTS (Resolute Raccoon)
AMD EPYC 9V45 4.02GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 10.0.303
  [Host] : .NET 8.0.33 (8.0.33, 8.0.3326.52219), X64 RyuJIT x86-64-v4

Job=InProcess  Toolchain=InProcessEmitToolchain  IterationCount=15  
LaunchCount=1  WarmupCount=10  

Method Mean vs aweXpect Error StdDev Gen0 Gen1 Allocated vs aweXpect
JsonArrayElements_aweXpect 3,197.2 ns 66.20 ns 61.93 ns 0.2213 - 3.62 KB
JsonArrayElements_FluentAssertions 21,045.2 ns +558% 354.69 ns 331.78 ns 3.6621 0.1221 60.47 KB +1572%
JsonArrayInAnyOrder_aweXpect 5,423.8 ns 163.39 ns 144.84 ns 0.4120 - 6.77 KB
JsonArrayInAnyOrder_FluentAssertions 162,303.3 ns +2892% 4,640.28 ns 3,874.85 ns 31.0059 1.7090 509.37 KB +7420%
JsonEquality_aweXpect 1,689.8 ns 78.64 ns 73.56 ns 0.0763 - 1.27 KB
JsonEquality_FluentAssertions 1,125.7 ns -33% 7.59 ns 6.73 ns 0.1564 - 2.56 KB +102%
JsonNestedPropertyChain_aweXpect 1,389.6 ns 18.58 ns 14.51 ns 0.1831 - 3 KB
JsonNestedPropertyChain_FluentAssertions 609.1 ns -56% 9.25 ns 8.65 ns 0.3071 - 5.03 KB +68%
JsonProperty_aweXpect 1,679.2 ns 37.06 ns 30.95 ns 0.1736 - 2.84 KB
JsonProperty_FluentAssertions 990.3 ns -41% 14.20 ns 11.86 ns 0.3719 - 6.08 KB +114%
JsonPropertyChain_aweXpect 1,789.1 ns 30.64 ns 27.16 ns 0.2308 0.0019 3.78 KB
JsonPropertyChain_FluentAssertions 719.7 ns -60% 25.57 ns 22.67 ns 0.3557 - 5.82 KB +54%
JsonString_aweXpect 1,204.0 ns 13.47 ns 11.94 ns 0.0668 - 1.11 KB
JsonString_FluentAssertions 7,755.0 ns +544% 188.89 ns 176.69 ns 1.5564 0.0305 25.53 KB +2201%
JsonStringCollection_aweXpect 99,661.1 ns 2,777.88 ns 2,598.43 ns 4.0283 - 66.08 KB
JsonStringCollection_FluentAssertions 115,670.8 ns +16% 1,490.08 ns 1,244.28 ns 15.8691 0.1221 260.68 KB +295%
JsonStringExpectations_aweXpect 1,549.1 ns 29.67 ns 27.75 ns 0.1431 - 2.34 KB
JsonStringExpectations_FluentAssertions 1,072.2 ns -31% 8.48 ns 6.62 ns 0.2766 - 4.55 KB +94%
ParsedJson_aweXpect 985.5 ns 34.52 ns 30.60 ns 0.0648 - 1.09 KB
ParsedJson_FluentAssertions 7,962.3 ns +708% 426.90 ns 399.32 ns 1.5106 0.0305 24.72 KB +2176%

aweXpect.Web

Compared to main @​ dbfb8e56

✅ No changes in memory or relative performance (6 benchmarks)

All benchmarks compared to main
Benchmark Time Memory vs FluentAssertions
Content 454.3 ns → 445.5 ns (-2%) 640 B → 640 B 2.17× → 2.14×
Header 985.9 ns → 1.03 μs (+5%) 1,192 B → 1,192 B 0.95× → 0.96×
ProblemDetails 1.88 μs → 1.89 μs (+1%) 1,592 B → 1,592 B 11.0× → 11.4×
QueryParameter 784.5 ns → 836.2 ns (+7%) 1,040 B → 1,040 B 1.64× → 1.61×
RequestMessage 1.30 μs → 1.29 μs (±0%) 1,440 B → 1,440 B 0.56× → 0.58×
SuccessStatusCode 246.5 ns → 249.7 ns (+1%) 528 B → 528 B 1.01× → 0.98×
Raw results
BenchmarkDotNet v0.15.8, Linux Ubuntu 26.04.1 LTS (Resolute Raccoon)
AMD EPYC 7763 2.45GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 10.0.303
  [Host] : .NET 8.0.33 (8.0.33, 8.0.3326.52219), X64 RyuJIT x86-64-v3

Job=InProcess  Toolchain=InProcessEmitToolchain  IterationCount=15  
LaunchCount=1  WarmupCount=10  

Method Mean vs aweXpect Error StdDev Gen0 Gen1 Allocated vs aweXpect
Content_aweXpect 445.5 ns 3.88 ns 3.44 ns 0.0381 - 640 B
Content_FluentAssertions 955.5 ns +114% 16.38 ns 15.32 ns 0.1965 - 3288 B +414%
Header_aweXpect 1,034.5 ns 13.45 ns 12.58 ns 0.0706 - 1192 B
Header_FluentAssertions 992.0 ns -4% 7.34 ns 6.51 ns 0.1831 - 3088 B +159%
ProblemDetails_aweXpect 1,891.3 ns 10.68 ns 9.99 ns 0.0935 - 1592 B
ProblemDetails_FluentAssertions 21,643.7 ns +1044% 113.45 ns 94.74 ns 2.0447 0.0305 34713 B +2080%
QueryParameter_aweXpect 836.2 ns 9.21 ns 8.62 ns 0.0620 - 1040 B
QueryParameter_FluentAssertions 1,348.2 ns +61% 14.65 ns 12.99 ns 0.2365 - 3968 B +282%
RequestMessage_aweXpect 1,294.9 ns 11.92 ns 10.57 ns 0.0858 - 1440 B
RequestMessage_FluentAssertions 746.5 ns -42% 8.51 ns 7.96 ns 0.1650 - 2768 B +92%
SuccessStatusCode_aweXpect 249.7 ns 1.57 ns 1.47 ns 0.0315 - 528 B
SuccessStatusCode_FluentAssertions 243.6 ns -2% 2.33 ns 1.95 ns 0.0567 - 952 B +80%

aweXpect.Xml

Compared to main @​ dbfb8e56

Memory

Benchmark main PR Δ
XmlString 24,179 B 24,178 B 🟢 -1 B (±0%)
All benchmarks compared to main
Benchmark Time Memory vs FluentAssertions
Attribute 792.6 ns → 917.4 ns (+16%) 1,000 B → 1,000 B 0.83× → 0.75×
ElementMatches 2.59 μs → 2.78 μs (+7%) 12,654 B → 12,654 B 1.37× → 1.23×
ElementOrder 13.18 μs → 14.04 μs (+6%) 25,367 B → 25,367 B 24.4× → 25.6×
XmlString 4.26 μs → 4.39 μs (+3%) 24,179 B → 24,178 B 1.19× → 1.19×
Raw results
BenchmarkDotNet v0.15.8, Linux Ubuntu 26.04.1 LTS (Resolute Raccoon)
AMD EPYC 7763 2.45GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 10.0.303
  [Host] : .NET 8.0.33 (8.0.33, 8.0.3326.52219), X64 RyuJIT x86-64-v3

Job=InProcess  Toolchain=InProcessEmitToolchain  IterationCount=15  
LaunchCount=1  WarmupCount=10  

Method Mean vs aweXpect Error StdDev Gen0 Gen1 Allocated vs aweXpect
Attribute_aweXpect 917.4 ns 7.70 ns 6.83 ns 0.0591 - 1000 B
Attribute_FluentAssertions 685.8 ns -25% 22.52 ns 21.07 ns 0.1659 - 2776 B +178%
ElementMatches_aweXpect 2,782.9 ns 81.08 ns 75.84 ns 0.7553 0.0305 12654 B
ElementMatches_FluentAssertions 3,418.0 ns +23% 43.36 ns 36.21 ns 0.8621 0.0343 14443 B +14%
ElementOrder_aweXpect 14,038.1 ns 209.84 ns 196.28 ns 1.5106 0.0458 25367 B
ElementOrder_FluentAssertions 359,730.4 ns +2463% 2,239.32 ns 1,985.10 ns 32.2266 1.9531 544335 B +2046%
XmlString_aweXpect 4,391.1 ns 39.66 ns 33.12 ns 1.4420 0.0610 24178 B
XmlString_FluentAssertions 5,242.4 ns +19% 262.06 ns 245.13 ns 1.5335 0.0153 25758 B +7%

aweXpect.Reflection

Compared to main @​ 19fa288e

✅ No changes in memory or relative performance (6 benchmarks)

All benchmarks compared to main
Benchmark Time Memory vs FluentAssertions
MethodsAreAsync 2.31 μs → 2.79 μs (+21%) 3,152 B → 3,152 B 1.48× → 1.35×
TypeHasAttribute 571.6 ns → 662.8 ns (+16%) 368 B → 368 B 1.42× → 1.34×
TypeIsNotStatic 94.6 ns → 106.0 ns (+12%) 168 B → 168 B 2.06× → 1.92×
TypeNullability 316.1 ns → 380.2 ns (+20%) 568 B → 568 B 6.16× → 5.92×
TypesAreSealed 1.57 μs → 1.91 μs (+21%) 1,856 B → 1,856 B 0.82× → 0.73×
TypesDoNotDependOn 2.49 μs → 2.90 μs (+16%) 3,264 B → 3,264 B 103.7× → 97.4×
Raw results
BenchmarkDotNet v0.15.8, Linux Ubuntu 26.04.1 LTS (Resolute Raccoon)
AMD EPYC 7763 3.22GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 10.0.303
  [Host] : .NET 10.0.14 (10.0.14, 10.0.1426.52326), X64 RyuJIT x86-64-v3

Job=InProcess  Toolchain=InProcessEmitToolchain  IterationCount=15  
LaunchCount=1  WarmupCount=10  

Method Mean vs aweXpect Error StdDev Gen0 Gen1 Allocated vs aweXpect
MethodsAreAsync_aweXpect 2,788.9 ns 29.56 ns 27.65 ns 0.1869 - 3152 B
MethodsAreAsync_FluentAssertions 3,757.6 ns +35% 35.58 ns 31.54 ns 0.2365 - 3981 B +26%
TypeHasAttribute_aweXpect 662.8 ns 4.29 ns 4.01 ns 0.0219 - 368 B
TypeHasAttribute_FluentAssertions 889.0 ns +34% 5.84 ns 5.46 ns 0.0744 - 1248 B +239%
TypeIsNotStatic_aweXpect 106.0 ns 0.78 ns 0.69 ns 0.0100 - 168 B
TypeIsNotStatic_FluentAssertions 204.1 ns +92% 3.22 ns 3.01 ns 0.0615 - 1032 B +514%
TypeNullability_aweXpect 380.2 ns 2.48 ns 2.20 ns 0.0339 - 568 B
TypeNullability_FluentAssertions 2,250.0 ns +492% 26.45 ns 24.74 ns 0.1945 - 3288 B +479%
TypesAreSealed_aweXpect 1,909.2 ns 15.89 ns 14.08 ns 0.1106 - 1856 B
TypesAreSealed_FluentAssertions 1,385.7 ns -27% 7.81 ns 6.53 ns 0.1106 - 1864 B ±0%
TypesDoNotDependOn_aweXpect 2,900.0 ns 24.66 ns 23.07 ns 0.1945 - 3264 B
TypesDoNotDependOn_FluentAssertions 282,499.9 ns +9641% 1,389.10 ns 1,299.37 ns 0.9766 0.4883 17577 B +439%

github-actions Bot added a commit that referenced this pull request Oct 28, 2026
github-actions Bot added a commit that referenced this pull request Oct 28, 2026
github-actions Bot added a commit that referenced this pull request Oct 28, 2026
github-actions Bot added a commit that referenced this pull request Oct 28, 2026
github-actions Bot added a commit that referenced this pull request Oct 28, 2026
…eSystem with TimeProvider (#2148) by Valentin Breuß
github-actions Bot added a commit that referenced this pull request Oct 28, 2026
…eSystem with TimeProvider (#2148) by Valentin Breuß
github-actions Bot added a commit that referenced this pull request Oct 28, 2026
github-actions Bot added a commit that referenced this pull request Oct 28, 2026
github-actions Bot added a commit that referenced this pull request Oct 28, 2026
github-actions Bot added a commit that referenced this pull request Oct 28, 2026
vbreuss added a commit to Testably/aweXpect.Mockolate that referenced this pull request Oct 29, 2026
aweXpect 4.0.0-pre.3 replaces the experimental `ITimeSystem` with the standard `TimeProvider` (Testably/aweXpect#2148). It also adds `CancelAfter` on `IEvaluationContext`, which cancels on the clock of the evaluation, for extensions that wait with a timeout of their own, like a mock that waits for an interaction `Within(timeout)`.

The `Within` timeout and the `Then` budget used `CancellationTokenSource.CancelAfter` and so always elapsed in real time, while the elapsed time was measured on the clock of the evaluation. With `WithTimeProvider(…)` and a virtual clock, they now elapse on that clock as well, so the timeout and the measured time agree. On the default real clock the behaviour does not change.

The test helper `VirtualTimeSystem` is replaced by a `TimeProvider`, `VirtualTimeProvider`, whose timers fire when the test advances the clock. Two new tests check that `Within` and the `Then` budget elapse on the given clock; without the change they wait 30 seconds of real time.
@github-actions github-actions Bot added the state: released The issue is released label Nov 10, 2026
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.

1 participant