Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [Fact]
- public void WithValidUsernamePasswordReturnsTrue()
- {
- // Arrange
- var user = new Freelancer { Id = 1, Active = true, Username = "Username", PasswordHash = "ThisIsThePasswordHash" };
- var securityServiceMock = new Mock<ISecurityService>();
- securityServiceMock.Setup(a => a.ComputeHash("Password", 1)).Returns(() => "ThisIsThePasswordHash");
- var userServiceMock = new Mock<IUserService>();
- userServiceMock.Setup(a => a.GetUser("Username")).Returns(() => user);
- // Act
- var authenticationService = new AuthenticationService(securityServiceMock.Object, userServiceMock.Object);
- var isAuthenticated = authenticationService.Authenticate("Username", "Password");
- // Assert
- Assert.True(isAuthenticated);
- }
Advertisement
Add Comment
Please, Sign In to add comment