0

I want to write a unit test to validate a certificate that has a fixed expiration date. So I'd like to put the call to DateTime.Now to always return the same date

Theare are some way to mock DateTime.Now in xUnit projetct???

[Fact]
public void Test1()
{
  Assert.Equal(DateTime.Now, new DateTime(2004,04,04));
}
Kirk Larkin
  • 84,915
  • 16
  • 214
  • 203
Luciano Castro
  • 421
  • 4
  • 13

0 Answers0