public void ItExists() { // Arrange var controller = new LogonController(_logonService); // Act var response = controller.Post(null); }
public void ItReturnsAnIActionResult() { // Arrange var controller = new LogonController(_logonService); // Act var response = controller.Post(null); // Assert Assert.IsAssignableFrom <IActionResult>(response); }
public void ItReturnsSuccessfulLogonMessageWhenSuccessful() { // Arrange var controller = new LogonController(_logonService); var attempt = new LoginAttempt { Username = "******", Password = "******" }; // Act var response = (ObjectResult)controller.Post(attempt); // Assert Assert.Equal("Logon Successful", response.Value); }
public void ItReturnsUnauthorizedLogonMessageWhenUnauthorized() { // Arrange var controller = new LogonController(_logonService); var attempt = new LoginAttempt { Username = "******", Password = "******" }; // Act var response = (ObjectResult)controller.Post(attempt); // Assert Assert.Equal("Username or Password invalid", response.Value); }
public void ItReturnsUnauthorizedForInvalidPassword() { // Arrange var controller = new LogonController(_logonService); var attempt = new LoginAttempt { Username = "******", Password = "******" }; // Act var response = (ObjectResult)controller.Post(attempt); // Assert Assert.NotNull(response.StatusCode); Assert.Equal(HttpStatusCode.Unauthorized, (HttpStatusCode)response.StatusCode); }