Esempio n. 1
0
        public void ValidateCaptcha(string actualCaptchaCode, string userInput, bool expected)
        {
            // Arrange
            var mockLogger = new Mock <ILogger <SimpleCaptchaService> >();
            SimpleCaptchaService service = new SimpleCaptchaService(mockLogger.Object);

            // Act
            bool actual = service.ValidateCaptcha(actualCaptchaCode, userInput);

            // Assert
            Assert.Equal(expected, actual);
        }
Esempio n. 2
0
        public void ValidateCaptcha_ThrowsException()
        {
            // Arrange
            var mockLogger = new Mock <ILogger <SimpleCaptchaService> >();
            SimpleCaptchaService service = new SimpleCaptchaService(mockLogger.Object);

            // Act
            Action action = () => service.ValidateCaptcha("", "");

            // Assert
            var exception = Assert.Throws <ArgumentNullException>(action);

            Assert.Equal("Value cannot be null.", exception.Message);
        }