public void Handler_ThrowsArgumentNullException_WhenPasswordIsNull() { var userStore = new Mock <IUserStore <User, int> >(MockBehavior.Strict); var userManager = new UserManager <User, int>(userStore.Object); var handler = new HandleHashedPasswordQuery(userManager); var query = new HashedPassword(null); var exception = Assert.Throws <ArgumentNullException>(() => handler.Handle(query).Result); exception.ShouldNotBeNull(); }
public void Handler_ReturnsResult_FromUserManager_PasswordHasher(string password) { var userStore = new Mock <IUserStore <User, int> >(MockBehavior.Strict); var userManager = new UserManager <User, int>(userStore.Object); var handler = new HandleHashedPasswordQuery(userManager); var query = new HashedPassword(password); string result = handler.Handle(query).Result; result.ShouldNotBeNull(); }
public Task <string> Handle(HashedPassword query) { var hashedPassword = _userManager.PasswordHasher.HashPassword(query.Password); return(Task.FromResult(hashedPassword)); }