예제 #1
0
        public async Task IncrementLoginCounterByIpAddress_LoginCounterIsAccurate(string ipAddress)
        {
            // Arrange
            ILoginAttemptsRepository loginAttemptsRepository =
                new LoginAttemptsRepository(new SQLServerGateway(), new ConnectionStringData());

            // Act
            var oldLoginAttempt = await loginAttemptsRepository.GetLoginAttemptsByIpAddress(ipAddress);

            await loginAttemptsRepository.IncrementLoginCounterByIpAddress(ipAddress);

            var newLoginAttempt = await loginAttemptsRepository.GetLoginAttemptsByIpAddress(ipAddress);

            // Assert
            Assert.IsTrue(newLoginAttempt.LoginCounter == (oldLoginAttempt.LoginCounter + 1));
        }