public AuthController( IJwtSecurityTokenHelper jwtSecurityTokenHelper, IAuthenticationService authenticationService) { _jwtSecurityTokenHelper = jwtSecurityTokenHelper; _authenticationService = authenticationService; }
public async Task FindAsync_shouldReturnNotFound_WhenNoUserFound() { //Arrange tokenHelper = Substitute.For <IJwtSecurityTokenHelper>(); authenticationService = Substitute.For <IAuthenticationService>(); var viewModel = new AuthViewModel() { Username = "******", AccessKey = "userAccessKey" }; User userReturn = null; authenticationService.FindAsync(viewModel.Username).Returns(userReturn); var sut = new AuthController(tokenHelper, authenticationService); //Act var result = (ObjectResult)await sut.GetTokenAsync(viewModel); //Assert Assert.Equal((int)HttpStatusCode.Unauthorized, result.StatusCode); }
public AuthControllerTests() { tokenHelper = Substitute.For <IJwtSecurityTokenHelper>(); authenticationService = Substitute.For <IAuthenticationService>(); }