sdk/dotnet/test/Datasync.Common.Test/AssertEx.cs
/// <summary>
/// Asserts if the two dates are "close" to one another (enough so to be valid in terms of test speed)
/// timings)
/// </summary>
/// <param name="expected"></param>
/// <param name="actual"></param>
/// <param name="interval"></param>
Asserts if the two dates are "close" to one another (enough so to be valid in terms of test speed)
timings)
Asserts if the two dates are " close " to one another ( enough so to be valid in terms of test speed ) timings )
public static void CloseTo(DateTimeOffset expected, DateTimeOffset actual, int interval = 3000)
        {
            var ms = Math.Abs((expected.Subtract(actual)).TotalMilliseconds);
            Assert.True(ms < interval, $"Date {expected} and {actual} are {ms}ms apart");
        }
public static void CloseTo ( DateTimeOffset expected , DateTimeOffset actual , int interval = 3000 ) { var ms = Math . Abs ( ( expected . Subtract ( actual ) ) . TotalMilliseconds ) ; Assert . True ( ms < interval , $" Date  { expected }  and  { actual }  are  { ms } ms apart " ) ; }
Asserts if the two dates are "close" to one another (enough so to be valid in terms of test speed)
timings)
Asserts if the two dates are " close " to one another ( enough so to be valid in terms of test speed ) timings )
expected
DateTimeOffset
None
actual
DateTimeOffset
None
interval
int
None