public void Verify_ForFreshToken_ReturnsCorrectExpiryDate() { var mockedDateTimeProvider = new Mock <IDateTimeProvider>(); var dateFormat = "yyyy-MM-dd HH:mm"; var dateNow = DateTime.UtcNow; // we are using mocked IDateTimeProvider to make sure we are refering to same "now" mockedDateTimeProvider.Setup(p => p.GetNow()).Returns(dateNow); var parser = new JwtParser(mockedDateTimeProvider.Object); var dateNowFutureString = dateNow.AddDays(parser.GetExpiredDays()).ToString(dateFormat); AcquireTokenModel tokenModel = parser.AcquireToken("*****@*****.**", 1); VerifyResultModel result = parser.Verify(tokenModel.Token); string expiryDateString = null; if (result.ExpiryDate != null) { expiryDateString = result.ExpiryDate.Value.ToString(dateFormat); } Assert.Equal(dateNowFutureString, expiryDateString); }