public void TotalErrorLimitHasNotBeenExceeded_CheckFrequencyEqualsTenMinutes_ReturnsFalse() { // Arrange _configFileHelperStub.PrsErrorCheckFrequency = 10; _configFileHelperStub.PrsTimeoutErrorLimit = 100; _configFileHelperStub.PrsUnavailableErrorLimit = 100; _configFileHelperStub.PrsTotalErrorLimit = 50; DateTime _checkRunTime = DateTime.Now; int _numOfUnavailableErrors = 5; int _numOfTimeoutErrors = 5; _reportingMockEntity.tbPRSErrorMonitor.AddObject(TestHelpers.PopulateDatabaseTables.AddRowTotbPrsErrorMonitor.AddTableRow( _checkRunTime.AddMinutes(-9), _numOfUnavailableErrors, _numOfTimeoutErrors)); _reportingMockEntity.tbPRSErrorMonitor.AddObject(TestHelpers.PopulateDatabaseTables.AddRowTotbPrsErrorMonitor.AddTableRow( _checkRunTime.AddMinutes(-6), _numOfUnavailableErrors, _numOfTimeoutErrors)); _reportingMockEntity.tbPRSErrorMonitor.AddObject(TestHelpers.PopulateDatabaseTables.AddRowTotbPrsErrorMonitor.AddTableRow( _checkRunTime.AddMinutes(-3), _numOfUnavailableErrors, _numOfTimeoutErrors)); bool _totalLimitExceeded = false; CheckPrsErrorLevels _checkPrsErrorLevels = new CheckPrsErrorLevels(_mockRepository, _configFileHelperStub, _log); // Act _totalLimitExceeded = _checkPrsErrorLevels.PrsTotalErrorLevelExceeded(); // Assert Assert.IsFalse(_totalLimitExceeded); }
public void IssueHasAlreadyBeenReporeted_ConfigValueEqualsZero_ReturnsFalse() { // Arrange _configFileHelperStub.EmailSentFlag = 0; bool _issueHasBeenReported = false; CheckPrsErrorLevels _checkPrsErrorLevels = new CheckPrsErrorLevels(_mockRepository, _configFileHelperStub, _log); // Act _issueHasBeenReported = _checkPrsErrorLevels.PrsIssueHasAlreadyBeenReported(); // Assert Assert.IsFalse(_issueHasBeenReported); }
public void UnavailableErrorLimitHasBeenExceeded_CheckFrequencyEqualsOneMinute_ReturnsTrue() { // Arrange _configFileHelperStub.PrsErrorCheckFrequency = 1; _configFileHelperStub.PrsUnavailableErrorLimit = 10; DateTime _checkRunTime = DateTime.Now; int _numOfUnavailableErrors = 20; int _numOfTimeoutErrors = 0; _reportingMockEntity.tbPRSErrorMonitor.AddObject(TestHelpers.PopulateDatabaseTables.AddRowTotbPrsErrorMonitor.AddTableRow( _checkRunTime, _numOfUnavailableErrors, _numOfTimeoutErrors)); bool _unavailableErrorLimitExceeded = false; CheckPrsErrorLevels _checkPrsErrorLevels = new CheckPrsErrorLevels(_mockRepository, _configFileHelperStub, _log); // Act _unavailableErrorLimitExceeded = _checkPrsErrorLevels.PrsUnavailableErrorLevelExceeded(); // Assert Assert.IsTrue(_unavailableErrorLimitExceeded); }