diff --git a/src/UnitTesting.Common/OptionalExtensions.cs b/src/UnitTesting.Common/OptionalExtensions.cs index 0f89ed4f..cc5fc46d 100644 --- a/src/UnitTesting.Common/OptionalExtensions.cs +++ b/src/UnitTesting.Common/OptionalExtensions.cs @@ -8,9 +8,9 @@ namespace UnitTesting.Common; public static class OptionalExtensions { public static AndConstraint BeNear(this OptionalAssertions assertions, - DateTime nearbyTime, int precision = 850, string because = "", params object[] becauseArgs) + Optional nearbyTime, int precision = 850, string because = "", params object[] becauseArgs) { - return new DateTimeAssertions(!assertions.Subject.HasValue + return new DateTimeAssertions(assertions.Subject.HasValue ? assertions.Subject.Value : null) .BeNear(nearbyTime, TimeSpan.FromMilliseconds(precision), because, becauseArgs);