2024-08-23 18:02:18 +02:00
|
|
|
|
using FluentAssertions;
|
|
|
|
|
|
|
2025-06-12 18:22:37 +02:00
|
|
|
|
namespace Vegasco.Server.Api.Tests.Integration;
|
|
|
|
|
|
|
2024-08-23 18:02:18 +02:00
|
|
|
|
internal static class FluentAssertionConfiguration
|
|
|
|
|
|
{
|
|
|
|
|
|
private const int DateTimeComparisonPrecision = 100;
|
|
|
|
|
|
|
|
|
|
|
|
internal static void SetupGlobalConfig()
|
|
|
|
|
|
{
|
|
|
|
|
|
AssertionOptions.AssertEquivalencyUsing(options => options
|
|
|
|
|
|
.Using<DateTime>(ctx => ctx.Subject.ToUniversalTime().Should().BeCloseTo(ctx.Expectation.ToUniversalTime(), TimeSpan.FromMilliseconds(DateTimeComparisonPrecision)))
|
|
|
|
|
|
.WhenTypeIs<DateTime>());
|
|
|
|
|
|
|
|
|
|
|
|
AssertionOptions.AssertEquivalencyUsing(options => options
|
|
|
|
|
|
.Using<DateTimeOffset>(ctx => ctx.Subject.ToUniversalTime().Should().BeCloseTo(ctx.Expectation.ToUniversalTime(), TimeSpan.FromMilliseconds(DateTimeComparisonPrecision)))
|
|
|
|
|
|
.WhenTypeIs<DateTimeOffset>());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|