public void EnsureCorrectTimeThrowsOnInCorrectTime2() { var testdate = new DateTime(2017, 2, 18, 17, 15, 46); var tp1 = new TestTimeProvider(testdate); var tp2 = new TestTimeProvider(testdate.AddSeconds(-6)); //Negative var target = new TwoFactorAuth(timeprovider: tp1); target.EnsureCorrectTime(new[] { tp2 }, 5); }
public void EnsureCorrectTimeDoesNotThrowOnCorrectTimeWithinLeniency() { var testdate = new DateTime(2017, 2, 18, 17, 15, 46); var tp1 = new TestTimeProvider(testdate); var tp2 = new TestTimeProvider(testdate.AddSeconds(5)); var target = new TwoFactorAuth(timeprovider: tp1); target.EnsureCorrectTime(new[] { tp2 }, 5); }
public void EnsureCorrectTimeThrowsOnInCorrectTime1() { var testdate = new DateTime(2017, 2, 18, 17, 15, 46); var tp1 = new TestTimeProvider(testdate); var tp2 = new TestTimeProvider(testdate.AddSeconds(6)); //Positive var target = new TwoFactorAuth(null, 8, 30, Algorithm.SHA1, new TestQrProvider(), new TestRNGProvider(), tp1); target.EnsureCorrectTime(new[] { tp2 }, 5); }
public void EnsureCorrectTimeDoesNotThrowOnCorrectTime() { var testdate = new DateTime(2017, 2, 18, 17, 15, 46); var tp1 = new TestTimeProvider(testdate); var tp2 = new TestTimeProvider(testdate); var target = new TwoFactorAuth(timeprovider: tp1); target.EnsureCorrectTime(new[] { tp2 }, 0); }