Esempio n. 1
0
        public void ItExists()
        {
            // Arrange
            var controller = new LogonController(_logonService);

            // Act
            var response = controller.Post(null);
        }
Esempio n. 2
0
        public void ItReturnsAnIActionResult()
        {
            // Arrange
            var controller = new LogonController(_logonService);

            // Act
            var response = controller.Post(null);

            // Assert
            Assert.IsAssignableFrom <IActionResult>(response);
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
        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);
        }