Beispiel #1
0
        public async Task UpdateSuspensionEndTimeById_SuspensionEndtimeIsAccurate(int id, string expectedSuspensionEndTime)
        {
            // Arrange
            ILoginAttemptsRepository loginAttemptsRepository =
                new LoginAttemptsRepository(new SQLServerGateway(), new ConnectionStringData());

            // Act
            await loginAttemptsRepository.UpdateSuspensionEndTimeById(id,
                                                                      DateTimeOffset.Parse(expectedSuspensionEndTime));

            var newLoginAttempt = await loginAttemptsRepository.GetLoginAttemptsById(id);

            var actualSuspensionEndTime = newLoginAttempt.SuspensionEndTime;

            // Assert
            Assert.IsTrue(actualSuspensionEndTime == DateTimeOffset.Parse(expectedSuspensionEndTime));
        }
Beispiel #2
0
        public async Task UpdateSuspensionEndtimeById_ExecutionTimeLessThan400Milliseconds
            (int id, string suspensionEndTime, long expectedMaxExecutionTime)
        {
            // Arrange
            ILoginAttemptsRepository loginAttemptsRepository = new LoginAttemptsRepository
                                                                   (new SQLServerGateway(), new ConnectionStringData());

            // Act
            var timer = Stopwatch.StartNew();
            await loginAttemptsRepository.UpdateSuspensionEndTimeById(id, DateTimeOffset.Parse(suspensionEndTime));

            timer.Stop();

            var actualExecutionTime = timer.ElapsedMilliseconds;

            Debug.WriteLine("Actual Execution Time: " + actualExecutionTime);

            // Assert
            Assert.IsTrue(actualExecutionTime <= expectedMaxExecutionTime);
        }