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)); }
public void TestPasswordStrengthforMedium() { //Assemble the test to check the strength of password PasswordStrengthController PasswordStrengthCheck = new PasswordStrengthController(); //Expected Result of the Test string expectedResult = "Password is Medium"; //Actual Result of the Test for password "Beautiful1" which doesnot satisfy all the requirements string actualResult = PasswordStrengthCheck.StrengthCheck("Beautiful1"); //Match expected result with actual result Assert.AreEqual(expectedResult, actualResult); }
public void TestPasswordStrengthforBlank() { //Assemble the test to check the strength of password PasswordStrengthController PasswordStrengthCheck = new PasswordStrengthController(); //Expected Result of the Test string expectedResult = "Password is Blank"; //Actual Result of the Test for blank password string actualResult = PasswordStrengthCheck.StrengthCheck(""); //Match expected result with actual result Assert.AreEqual(expectedResult, actualResult); }
public async Task TestPasswordNoDataBreach() { //Assemble the test to check the strength of password PasswordStrengthController PasswordDataBreachCheck = new PasswordStrengthController(); //Expected Result of the Test is null string expectedResult = null; //Actual Result of the Test for data breach for password "S@12hb" is null string actualResult = await PasswordDataBreachCheck.PasswordBreachCheck("S@12hb"); //Match expected result with actual result Assert.AreEqual(expectedResult, actualResult); }