public void OneTimePassword_IsGeneratedCorrectlyForGoogleTests(long counter, string expectedPassword) { // Arrange var otpGenerator = new HotpGenerator(); // Act var password = otpGenerator.GeneratePassword(googleSecret, counter, PasswordLengths.SixDigitPassword); // Assert Assert.Equal(expectedPassword, password); }
public void OneTimePassword_IsNumeric(long counter) { // Arrange var secret = Encoding.ASCII.GetBytes("0000000000"); var otpGenerator = new HotpGenerator(); // Act var password = otpGenerator.GeneratePassword(secret, counter, PasswordLengths.SixDigitPassword); // Assert Assert.True(int.TryParse(password, out int temp)); }
public void OneTimePassword_OfTheCorrectLength_IsGenerated(int expectedLength) { // Arrange var secret = Encoding.ASCII.GetBytes("0000000000"); var otpGenerator = new HotpGenerator(); // Act var password = otpGenerator.GeneratePassword(secret, 0, new PasswordLength(expectedLength)); // Assert Assert.Equal(password.Length, expectedLength); }
public void APassword_OfTheCorrectNumberOfDigits_IsGenerated(long counter, IPasswordLength length, int expectedLength) { // Arrange var secret = Encoding.UTF8.GetBytes("000000000000"); var otpGenerator = new HotpGenerator(); // Act var password = otpGenerator.GeneratePassword(secret, counter, length); // Assert Assert.Equal(password.Length, expectedLength); }