-
Notifications
You must be signed in to change notification settings - Fork 643
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixing the change password changes that were merged, according to oth…
…er changes that have happened since then (like adding the new has algorithm) (fixes #356)
- Loading branch information
Showing
3 changed files
with
6 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -603,13 +603,12 @@ public void FindsUsersByUserName() | |
var user = new User { Username = "theUsername", HashedPassword = "thePassword", EmailAddress = "[email protected]" }; | ||
var userRepository = new Mock<IEntityRepository<User>>(); | ||
userRepository.Setup(r => r.GetAll()).Returns(new[] { user }.AsQueryable()); | ||
|
||
var crypto = new Mock<ICryptographyService>(); | ||
crypto.Setup(c => c.ValidateSaltedHash(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>())).Returns(true); | ||
|
||
var service = CreateUsersService(cryptoSvc: crypto, userRepo: userRepository); | ||
|
||
var foundByUserName = service.FindByUsernameOrEmailAddressAndPassword("theUsername", "thePassword"); | ||
var foundByUserName = service.FindByUsernameAndPassword("theUsername", "thePassword"); | ||
|
||
Assert.NotNull(foundByUserName); | ||
Assert.Same(user, foundByUserName); | ||
} | ||
|
@@ -620,13 +619,12 @@ public void WillNotFindsUsersByEmailAddress() | |
var user = new User { Username = "theUsername", HashedPassword = "thePassword", EmailAddress = "[email protected]" }; | ||
var userRepository = new Mock<IEntityRepository<User>>(); | ||
userRepository.Setup(r => r.GetAll()).Returns(new[] { user }.AsQueryable()); | ||
|
||
var crypto = new Mock<ICryptographyService>(); | ||
crypto.Setup(c => c.ValidateSaltedHash(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>())).Returns(true); | ||
|
||
var service = CreateUsersService(cryptoSvc: crypto, userRepo: userRepository); | ||
|
||
var foundByEmailAddress = service.FindByUsernameAndPassword("[email protected]", "thePassword"); | ||
|
||
Assert.Null(foundByEmailAddress); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters