Esempio n. 1
0
 public TransactionAddManager(CSVParser parser            = null, TransactionFactory transactionFactory = null,
                              ReportWatcher reportWatcher = null)
 {
     this._parser             = parser;
     this._transactionFactory = transactionFactory;
     this._reportWatcher      = reportWatcher;
 }
        public void TestWatcherInitialization()
        {
            //watcher not work
            var  reportWatcher = new ReportWatcher <object>(0);
            uint max           = uint.MaxValue;

            Assert.Throws <OverflowException>(() => new ReportWatcher <object>(max * 2));
            Assert.True(reportWatcher.WatchReport(new BacktraceReport("test")));
        }
Esempio n. 3
0
 public TransactionAddManager(FileSystemWatcher fileSystemWatcher, ADO.UnitOfWork.IUnitOfWork <CSVTransaction> unitOfWork)
 {
     this._unitOfWork         = unitOfWork;
     this._transactionFactory = new TransactionFactory();
     this.ReportWatcher       = new ReportWatcher(fileSystemWatcher);
     this._data = new List <CSVTransaction>();
     this.ReportWatcher.ReportFileAdded += new ReportWatcher.ReportFileAddedHandler(OnTransactionFileCreated);
     this.ReportWatcher.StartWatch();
 }
Esempio n. 4
0
 /// <summary>
 /// Initialize new client instance with BacktraceCredentials
 /// </summary>
 /// <param name="backtraceCredentials">Backtrace credentials to access Backtrace API</param>
 /// <param name="attributes">Additional information about current application</param>
 /// <param name="databaseDirectory">Database path</param>
 /// <param name="reportPerMin">Number of reports sending per one minute. If value is equal to zero, there is no request sending to API. Value have to be greater than or equal to 0</param>
 public BacktraceBase(
     BacktraceCredentials backtraceCredentials,
     Dictionary <string, T> attributes = null,
     string databaseDirectory          = "",
     uint reportPerMin = 3)
 {
     _attributes    = attributes ?? new Dictionary <string, T>();
     _database      = new BacktraceDatabase <T>(databaseDirectory);
     _backtraceApi  = new BacktraceApi <T>(backtraceCredentials);
     _reportWatcher = new ReportWatcher <T>(reportPerMin);
 }
        public void TestQueueAddOperations()
        {
            var reportWatcher = new ReportWatcher <object>(2);

            Assert.DoesNotThrow(() => reportWatcher.WatchReport(new BacktraceReport("text information")));
            Thread.Sleep(3000);
            Assert.IsTrue(reportWatcher.WatchReport(new BacktraceReport("last available information")));
            Assert.IsFalse(reportWatcher.WatchReport(new BacktraceReport("invalid message")));
            Thread.Sleep(57000);
            Assert.IsTrue(reportWatcher.WatchReport(new BacktraceReport("after clean + available message")));
            Assert.IsTrue(reportWatcher._reportQue.Count == 2);
        }