Skip to content

Commit

Permalink
Minor fix and unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander van Delft committed Apr 12, 2024
1 parent 98aa64c commit 542c8b4
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ public void VerifyTimeOfDayParameterTypeValidationAndCleanup()
Assert.Multiple(() =>
{
Assert.That(result.ResultKind, Is.EqualTo(ValidationResultKind.Valid));
Assert.That(cleanedValue3, Is.EqualTo("0001-01-01T12:45:35.0000000"));
Assert.That(cleanedValue3, Is.EqualTo("0001-01-01T12:45:35.0000000+01:00"));
});

result = this.timeOfDayParameterType.Validate(new DateTime(2001, 1, 1, 12, 45, 35, DateTimeKind.Utc), out _);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ public void VerifyTimeOfDayParameterTypeValidationAndCleanup()
Assert.Multiple(() =>
{
Assert.That(result.ResultKind, Is.EqualTo(ValidationResultKind.Valid));
Assert.That(cleanedValue3, Is.EqualTo("0001-01-01T12:45:35.0000000"));
Assert.That(cleanedValue3, Is.EqualTo("0001-01-01T12:45:35.0000000+01:00"));
});

result = this.timeOfDayParameterType.Validate(new DateTime(2001, 1, 1, 12, 45, 35, DateTimeKind.Utc), out _);
Expand Down
5 changes: 0 additions & 5 deletions CDP4Common/Validation/ObjectValueValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -500,11 +500,6 @@ public static ValidationResult ValidateTimeOfDay(this object value, out string c

if (value is DateTime dtValue)
{
if (dtValue.Kind == DateTimeKind.Local)
{
dtValue = DateTime.SpecifyKind(dtValue, DateTimeKind.Unspecified);
}

cleanedValue = dtValue.ToString("o");
Logger.Debug("TimeOfDay {0} validated", cleanedValue);
return ValidationResult.ValidResult();
Expand Down

0 comments on commit 542c8b4

Please sign in to comment.