@@ -127,6 +127,7 @@ using static SharpAssert.Sharp; // For Assert(), Throws<T>()
127127using SharpAssert ; // For custom expectations (IsEquivalentTo, etc.)
128128using SharpAssert .Features .Collections ; // For IsInAscendingOrder(), AllUnique()
129129using SharpAssert .Features .Strings ; // For Matches(), occurrence counting
130+ using SharpAssert .Features .Proximity ; // For BeCloseTo(), BeApproximately()
130131```
131132
132133Migration:
@@ -220,12 +221,15 @@ act.Should().Throw<T>().WithMessage(msg) → var ex = Throws<T>(act);
220221val .Should ().BePositive () → Assert (val > 0 )
221222val .Should ().BeNegative () → Assert (val < 0 )
222223val .Should ().BeInRange (min , max ) → Assert (val >= min && val <= max )
223- val .Should ().BeCloseTo (target , precision ) → Assert (Math .Abs (val - target ) <= precision )
224- val .Should ().BeApproximately (pi , 0 . 01 ) → Assert (Math .Abs (val - pi ) <= 0 . 01 )
224+ val .Should ().BeCloseTo (target , precision ) → Assert (val .BeCloseTo (target , precision ))
225+ // Or native: Assert(Math.Abs(val - target) <= precision)
226+ val .Should ().BeApproximately (pi , 0 . 01 ) → Assert (val .BeApproximately (pi , 0 . 01 ))
227+ // Or native: Assert(Math.Abs(val - pi) <= 0.01)
225228
226229// DateTime Proximity
227230dt .Should ().BeCloseTo (expected , 100 .Milliseconds ())
228- → Assert (Math .Abs ((dt - expected ).TotalMilliseconds ) <= 100 )
231+ → Assert (dt .BeCloseTo (expected , TimeSpan .FromMilliseconds (100 )))
232+ // Or native: Assert(Math.Abs((dt - expected).TotalMilliseconds) <= 100)
229233dt .Should ().BeAfter (baseDate ).Within (5 .Minutes ())
230234 → Assert (dt >= baseDate && dt <= baseDate .AddMinutes (5 ))
231235dt .Should ().BeBefore (deadline ).Within (1 .Hours ())
0 commit comments