var dte = "2021-12-18T15:06:33.2677927Z"
dte.Should().
I want to check that this dte is not empty.
Currently I am using :
dte.Should().BeAfter(new DateTime());
var dte = "2021-12-18T15:06:33.2677927Z"
dte.Should().
I want to check that this dte is not empty.
Currently I am using :
dte.Should().BeAfter(new DateTime());
From the example, your definition of an "empty" DateTime
seems to be one different from the default value.
If you're looking for a more readable/idiomatic way to express that, I would go with
DateTime subject = MethodUnderTest();
subject.Should().NotBe(default);
For the general case, one cannot speak of an "empty" DateTime
since even the default value is just the minimum representable valid datetime, namely 0001-01-01T00:00:00
.
So all of these are identical.
DateTime.Parse("0001-01-01T00:00:00")
default(DateTime)
new DateTime()
DateTime.MinValue
DateTime.FromBinary(0)