public void ComparePassword() { //Arrange BoardGameDatabase.Interfaces.Validators.IPasswordValidation validation = new PasswordValidation(); string password1 = "someG0)dPa$"; string password2 = "Ano*9Pa@@s"; //Act var resultOk1 = validation.ComparePassword(password1, BoardGameDatabase.Operations.HashEncryption.Hash(password1)); var resultOk2 = validation.ComparePassword(password2, BoardGameDatabase.Operations.HashEncryption.Hash(password2)); var resultNotCompare = validation.ComparePassword(password1, BoardGameDatabase.Operations.HashEncryption.Hash(password2)); var resultNullPassword = validation.ComparePassword(null, BoardGameDatabase.Operations.HashEncryption.Hash(password1)); var resultWitheSpacePassword = validation.ComparePassword(" ", BoardGameDatabase.Operations.HashEncryption.Hash(password1)); //Assert Assert.AreEqual(resultOk1.IsSucces, true); Assert.AreEqual(resultOk1.ErrorList.Count, 0); Assert.AreEqual(resultOk2.IsSucces, true); Assert.AreEqual(resultOk2.ErrorList.Count, 0); Assert.AreEqual(resultNotCompare.IsSucces, false); Assert.AreEqual(resultNotCompare.ErrorList.Any(a => a.Key == ValidationKey.PasswordNotCompare.ToString()), true); Assert.AreEqual(resultNotCompare.ErrorList.Count, 1); Assert.AreEqual(resultNullPassword.IsSucces, false); Assert.AreEqual(resultNullPassword.ErrorList.Any(a => a.Key == ValidationKey.NoPassword.ToString()), true); Assert.AreEqual(resultNullPassword.ErrorList.Count, 1); Assert.AreEqual(resultWitheSpacePassword.IsSucces, false); Assert.AreEqual(resultWitheSpacePassword.ErrorList.Any(a => a.Key == ValidationKey.NoPassword.ToString()), true); Assert.AreEqual(resultWitheSpacePassword.ErrorList.Count, 1); }