public PasswordStrengthServiceTest() { _moqPwnedPasswordService = new Mock <IPwnedPasswordService>(); _moqPwnedPasswordService.Setup(s => s.GetBreaches(It.IsAny <string>())).Returns("0"); _service = new PasswordStrengthService(_moqPwnedPasswordService.Object); }
public void VeryStrongPasswordTestCase() { var test = new PasswordStrengthService(); string actualValue = test.GetPasswordStrength("AShok@410"); Assert.Equal("VeryStrong", actualValue); }
public void BlankPasswordTestCase() { var test = new PasswordStrengthService(); string actualValue = test.GetPasswordStrength(""); Assert.Equal("Blank", actualValue); }
public void StrongPasswordTestCase() { var test = new PasswordStrengthService(); string actualValue = test.GetPasswordStrength("Ashokte1"); Assert.Equal("Strong", actualValue); }
public void MediumPasswordTestCase() { var test = new PasswordStrengthService(); string actualValue = test.GetPasswordStrength("AshokTest"); Assert.Equal("Medium", actualValue); }
public void WeakPasswordTestCase() { var test = new PasswordStrengthService(); string actualValue = test.GetPasswordStrength("abcdefga"); Assert.Equal("Weak", actualValue); }
private static int IsPawnedPassword(string password) { var client = new Mock <IHttpClientFactory>(); var mockRepo = new PasswordStrengthService(client.Object); var psc = new PasswordStrengthController(mockRepo); return(psc.GetPwnedCount(password).Result); }
private static string GetPasswordStrength(string password) { var client = new Mock <IHttpClientFactory>(); var mockRepo = new PasswordStrengthService(client.Object); var psc = new PasswordStrengthController(mockRepo); return(psc.GetPasswordStrength(password)); }