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 TimeoutErrorLimitHasBeenExceeded_CheckFrequencyEqualsOneMinute_ReturnsTrue()
        {
            // Arrange
            _configFileHelperStub.PrsErrorCheckFrequency = 1;
            _configFileHelperStub.PrsTimeoutErrorLimit = 10;
            DateTime _checkRunTime = DateTime.Now;
            int _numOfUnavailableErrors = 0;
            int _numOfTimeoutErrors = 20;
            _reportingMockEntity.tbPRSErrorMonitor.AddObject(TestHelpers.PopulateDatabaseTables.AddRowTotbPrsErrorMonitor.AddTableRow(
                _checkRunTime, _numOfUnavailableErrors, _numOfTimeoutErrors));
            bool _timeoutLimitExceeded = false;
            CheckPrsErrorLevels _checkPrsErrorLevels = new CheckPrsErrorLevels(_mockRepository, _configFileHelperStub, _log);

            // Act
            _timeoutLimitExceeded = _checkPrsErrorLevels.PrsTimeoutErrorLevelExceeded();

            // Assert
            Assert.IsTrue(_timeoutLimitExceeded);
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            ILogger _log = new Logger();
            ePharmacyEntities _ePharmEntity = new ePharmacyEntities();
            ReportingEntities _reportingEntity = new ReportingEntities();
            Repository _repository = new Repository(_ePharmEntity, _reportingEntity);

            try
            {
                // Check ePharmacy.tbAuditExchangeInbound for any PRS errors that have occured in the previous minute
                RecordPRSErrorActivity _recordPrsErrorActivity = new RecordPRSErrorActivity(_repository, _log);
                _recordPrsErrorActivity.RecordPRSErrorCounts();

                // ConfigFileHelper: Utility class to assist reading from / writing to the config file
                ConfigFileHelper _configFileHelper = new ConfigFileHelper();

                DetermineIfPrsErrorActivityShouldBeChecked _checkToolStatus = new DetermineIfPrsErrorActivityShouldBeChecked(_configFileHelper, _log);
                bool _shouldPrsErrorCheckBeRun = _checkToolStatus.Run();

                CheckPrsErrorLevels _checkPrsErrorLevels = new CheckPrsErrorLevels(_repository, _configFileHelper, _log);
                bool _unavailableErrorLimitExceeded = _checkPrsErrorLevels.PrsUnavailableErrorLevelExceeded();
                bool _timeoutErrorLimitExceeded = _checkPrsErrorLevels.PrsTimeoutErrorLevelExceeded();
                bool _totalErrorLimitExceeded = _checkPrsErrorLevels.PrsTotalErrorLevelExceeded();

                // If either of the bool values are true, then send a warning email
                if (_unavailableErrorLimitExceeded || _timeoutErrorLimitExceeded || _totalErrorLimitExceeded)
                {
                    ReportPrsErrors _reportErrors = new ReportPrsErrors(_log);
                    _reportErrors.SendEmail(_unavailableErrorLimitExceeded, _timeoutErrorLimitExceeded, _totalErrorLimitExceeded);
                }
            }
            catch(Exception ex)
            {
                _log.Add("Error Detected: " + ex.Message + ex.InnerException);
            }
            finally
            {
                _log.Write();
            }
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            ILogger           _log             = new Logger();
            ePharmacyEntities _ePharmEntity    = new ePharmacyEntities();
            ReportingEntities _reportingEntity = new ReportingEntities();
            Repository        _repository      = new Repository(_ePharmEntity, _reportingEntity);

            try
            {
                // Check ePharmacy.tbAuditExchangeInbound for any PRS errors that have occured in the previous minute
                RecordPRSErrorActivity _recordPrsErrorActivity = new RecordPRSErrorActivity(_repository, _log);
                _recordPrsErrorActivity.RecordPRSErrorCounts();

                // ConfigFileHelper: Utility class to assist reading from / writing to the config file
                ConfigFileHelper _configFileHelper = new ConfigFileHelper();

                DetermineIfPrsErrorActivityShouldBeChecked _checkToolStatus = new DetermineIfPrsErrorActivityShouldBeChecked(_configFileHelper, _log);
                bool _shouldPrsErrorCheckBeRun = _checkToolStatus.Run();

                CheckPrsErrorLevels _checkPrsErrorLevels = new CheckPrsErrorLevels(_repository, _configFileHelper, _log);
                bool _unavailableErrorLimitExceeded      = _checkPrsErrorLevels.PrsUnavailableErrorLevelExceeded();
                bool _timeoutErrorLimitExceeded          = _checkPrsErrorLevels.PrsTimeoutErrorLevelExceeded();
                bool _totalErrorLimitExceeded            = _checkPrsErrorLevels.PrsTotalErrorLevelExceeded();

                // If either of the bool values are true, then send a warning email
                if (_unavailableErrorLimitExceeded || _timeoutErrorLimitExceeded || _totalErrorLimitExceeded)
                {
                    ReportPrsErrors _reportErrors = new ReportPrsErrors(_log);
                    _reportErrors.SendEmail(_unavailableErrorLimitExceeded, _timeoutErrorLimitExceeded, _totalErrorLimitExceeded);
                }
            }
            catch (Exception ex)
            {
                _log.Add("Error Detected: " + ex.Message + ex.InnerException);
            }
            finally
            {
                _log.Write();
            }
        }