Skip to content

Commit

Permalink
Fixed IsNear testing method
Browse files Browse the repository at this point in the history
  • Loading branch information
jezzsantos committed Oct 23, 2024
1 parent 823d30b commit d6a02ea
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
18 changes: 12 additions & 6 deletions src/.run/AllHosts.run.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="AllHosts" type="CompoundRunConfigurationType">
<toRun name="ApiHost1: ApiHost1-Development" type="LaunchSettings" />
<toRun name="TestingStubApiHost: TestingStubApiHost-Development" type="LaunchSettings" />
<toRun name="WebsiteHost: WebsiteHost-Development" type="LaunchSettings" />
<method v="2" />
</configuration>
<configuration default="false" name="AllHosts" type="CompoundRunConfigurationType">
<toRun name="ApiHost1: ApiHost1-Development" type="LaunchSettings" />
<toRun name="TestingStubApiHost: TestingStubApiHost-Development" type="LaunchSettings" />
<toRun name="WebsiteHost: WebsiteHost-Development" type="LaunchSettings" />
<method v="2" />
</configuration>
<configuration default="false" name="AllHosts" type="CompoundRunConfigurationType">
<toRun name="ApiHost1: ApiHost1-Development" type="LaunchSettings" />
<toRun name="TestingStubApiHost: TestingStubApiHost-Development" type="LaunchSettings" />
<toRun name="WebsiteHost: WebsiteHost-Development" type="LaunchSettings" />
<method v="2" />
</configuration>
</component>
6 changes: 4 additions & 2 deletions src/UnitTesting.Common/OptionalExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ namespace UnitTesting.Common;
public static class OptionalExtensions
{
public static AndConstraint<DateTimeAssertions> BeNear(this OptionalAssertions<DateTime> assertions,
Optional<DateTime> nearbyTime, int precision = 850, string because = "", params object[] becauseArgs)
DateTime nearbyTime, int precision = 850, string because = "", params object[] becauseArgs)
{
return new DateTimeAssertions(nearbyTime.ValueOrDefault)
return new DateTimeAssertions(!assertions.Subject.HasValue
? assertions.Subject.Value
: null)
.BeNear(nearbyTime, TimeSpan.FromMilliseconds(precision), because, becauseArgs);
}

Expand Down

0 comments on commit d6a02ea

Please sign in to comment.