public void HashedPasswordTrueTest() { var password = "******"; string hashed = PasswordHasher.Hash(password); var user = new User() { Id = 1, Name = "John", Mail = "*****@*****.**", Password = hashed }; Users.Add(user); Context.SaveChanges(); var query = new PasswordIsValidQuery() { Mail = "*****@*****.**", Password = password }; var handler = new PasswordIsValidQueryHandler(Context, PasswordHasher); var result = handler.Handle(query, CancellationToken.None).Result; Assert.NotNull(result); }
public void NonExistantUserTest() { var password = "******"; string hashed = PasswordHasher.Hash(password); var query = new PasswordIsValidQuery() { Mail = "*****@*****.**", Password = password }; var handler = new PasswordIsValidQueryHandler(Context, PasswordHasher); var result = handler.Handle(query, CancellationToken.None).Result; Assert.Null(result); }