예제 #1
0
        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();
        }
예제 #2
0
        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();
        }
예제 #3
0
        public Task <string> Handle(HashedPassword query)
        {
            var hashedPassword = _userManager.PasswordHasher.HashPassword(query.Password);

            return(Task.FromResult(hashedPassword));
        }