Skip to content

Commit 9040a0b

Browse files
committed
added unit test for default(DateTime) conversion to DateMath
1 parent d3d94ff commit 9040a0b

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/Tests/Tests/CommonOptions/DateMath/DateMathTests.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,17 @@ public void ImplicitConversionFromNullNullableDateTime()
2222
dateMath.Should().BeNull();
2323
}
2424

25+
[U] // F# backticks would be great in C# :)
26+
public void ImplicitConversionFromDefaultDateTimeIsNotNullButEmptyString()
27+
{
28+
// in 6.x DateMath is backed by a DateTime instance
29+
// for 7.x we will adress this
30+
DateTime nullableDateTime = default;
31+
Nest.DateMath dateMath = nullableDateTime;
32+
dateMath.Should().NotBeNull();
33+
dateMath.ToString().Should().BeEmpty();
34+
}
35+
2536
[U]
2637
public void ImplicitConversionFromDateMathString()
2738
{
@@ -38,4 +49,5 @@ public void ImplicitConversionFromNullableDateTimeWithValue()
3849
dateMath.Should().NotBeNull();
3950
}
4051
}
52+
4153
}

0 commit comments

Comments
 (0)