public async Task ResetLoginCounterById_LoginCounterIsAccurate(int id) { // Arrange ILoginAttemptsRepository loginAttemptsRepository = new LoginAttemptsRepository(new SQLServerGateway(), new ConnectionStringData()); // Act await loginAttemptsRepository.ResetLoginCounterById(id); var newLoginAttempt = await loginAttemptsRepository.GetLoginAttemptsById(id); // Assert Assert.IsTrue(newLoginAttempt.LoginCounter == 0); }
public async Task ResetLoginCounterById_ExecutionTimeLessThan400Milliseconds (int id, long expectedMaxExecutionTime) { // Arrange ILoginAttemptsRepository loginAttemptsRepository = new LoginAttemptsRepository (new SQLServerGateway(), new ConnectionStringData()); // Act var timer = Stopwatch.StartNew(); await loginAttemptsRepository.ResetLoginCounterById(id); timer.Stop(); var actualExecutionTime = timer.ElapsedMilliseconds; Debug.WriteLine("Actual Execution Time: " + actualExecutionTime); // Assert Assert.IsTrue(actualExecutionTime <= expectedMaxExecutionTime); }