diff --git a/tests/FeaturesTests/Response.cs b/tests/FeaturesTests/Response.cs index 13aa0a0..c271a72 100644 --- a/tests/FeaturesTests/Response.cs +++ b/tests/FeaturesTests/Response.cs @@ -59,7 +59,17 @@ public void CheckDateValueProperty(string propertyName, string expectedPropValue { var propInfo = _actual.Data.GetType().GetProperty(propertyName); Assert.NotNull(propInfo); - Assert.Equal(DateTime.Parse(expectedPropValue).ToUniversalTime(), propInfo.GetValue(_actual.Data)); + Assert.IsType(propInfo.GetValue(_actual.Data)); + // Currently, we use DateTime type representation for both date and date-time. + // Until this behaviour changes, differentiate them on expected value and convert to DateOnly if necessary. + if (expectedPropValue.Contains("T")) + { + Assert.Equal(DateTime.Parse(expectedPropValue).ToUniversalTime(), propInfo.GetValue(_actual.Data)); + } + else + { + Assert.Equal(DateOnly.Parse(expectedPropValue), DateOnly.FromDateTime(propInfo.GetValue(_actual.Data))); + } } [And(@"the response should be equal to (""[\w\s]+"")")] @@ -145,7 +155,9 @@ public void CheckResponseDateDictionaryProperties(string propertyName, string ex { var actual = _actual.Data as Dictionary; Assert.NotNull(actual); - Assert.Equal(DateTime.Parse(expectedPropValue).ToUniversalTime(), actual[propertyName]); + // Currently, we use DateTime type representation for both date and date-time. + // Until this behaviour changes, differentiate them on expected value and convert to DateOnly if necessary. + Assert.Equal(DateOnly.Parse(expectedPropValue), DateOnly.FromDateTime(actual[propertyName])); } } } \ No newline at end of file