public void AssertDataLimitPassedIsFired() { var settings = new Settings(10, 100); var capSetts = new CaptureSettings("somt", new Dictionary<string, string>(), settings); ServiceProvider.TwitterProvider = new DataTests.MockService(); var session = new CaptureSession(capSetts); bool firstIntervalElapsed = false; settings.MaxDataPointsPassed += (sender, e) => firstIntervalElapsed = true; Timer timer = new System.Timers.Timer(1010); timer.Elapsed += (sender, e) => Assert.AreEqual(true, firstIntervalElapsed); session.StartCapture(); timer.Start(); while (!firstIntervalElapsed) { System.Threading.Thread.Sleep(5); } Assert.AreEqual(2, settings.IgnoreDataUpdateThreshold); bool secondIntervalElapsed = false; settings.MaxDataPointsPassed += (sender, e) => secondIntervalElapsed = true; System.Threading.Thread.Sleep(1250); Assert.AreEqual(true, secondIntervalElapsed); }
public override void StartListening(Model.CaptureSession session) { this._session = session; this._actions.Clear(); session.StatusProcessedEvent += session_StatusProcessedEvent; this._lastAddTime = new DateTime(); }
public void AssertAllDataIsKeptInView() { var settings = new Settings(10, 100); var capSetts = new CaptureSettings("somt", new Dictionary<string, string>(), settings); ServiceProvider.TwitterProvider = new DataTests.MockService(); var session = new CaptureSession(capSetts); var model = new StaticSessionViewModel(); model.StartListening(session); settings.MaxDataPointsPassed += (sender, args) => Assert.AreEqual(5, model.DeltaCount.Count); System.Threading.Thread.Sleep(100000); }
public void AssertSettingsAreCorrectlyStarted() { var settings = new Settings(10, 100); var capSetts = new CaptureSettings("somt", new Dictionary<string, string>(), settings); ServiceProvider.TwitterProvider = new DataTests.MockService(); var session = new CaptureSession(capSetts); Assert.AreEqual(false, settings.Started); session.StartCapture(); Assert.AreEqual(true, settings.Started); session.StopCapture(); Assert.AreEqual(false, settings.Started); }
private void PrepareForCapture() { var settings = new CaptureSettings(this.Settings); var capSession = new CaptureSession(settings); this.SessionStarted = true; this.Session.StartSession(capSession); this.OnPropertyChanged("SessionStarted"); this.OnPropertyChanged("SessionNotStarted"); }
public abstract void StartListening(CaptureSession session);
public void StartSession(CaptureSession session) { if (session == null) { throw new ArgumentNullException("session"); } this.Pages.Clear(); this.Session = session; this.Session.Settings.Settings.MaxDataPointsPassed += Settings_MaxDataPointsPassed; this.Session.StartCaptureNonBlocking(); this.Pages.Add(new StaticSessionViewModel()); #if DEBUG this.Pages.Add(new DebugTweetViewModel()); #endif foreach(var model in this.Pages) { model.StartListening(session); } this._intervalTimer = new Timer(); this._intervalTimer.Interval = this.Session.Settings.Settings.CountInterval; this._intervalTimer.Elapsed += _intervalTimer_Elapsed; this._intervalTimer.Start(); this.OnPropertyChanged("updateInterval"); }
public override void StartListening(CaptureSession session) { if (session == null) { throw new ArgumentNullException("session"); } this.Session = session; this._dataUpdatesDiscarded = 0; this.Session.CountAtInterval.CollectionChanged += CountAtInterval_CollectionChanged; this.Session.Settings.Settings.MaxDataPointsPassed += (sender, e) => Application.Current.Dispatcher.Invoke(() => this.RemakeDeltaCountList()); MakeSubjects(); this.Session.Subjects.CollectionChanged += Subjects_CollectionChanged; this.OnPropertyChanged("Session"); this.OnPropertyChanged("Subjects"); this.OnPropertyChanged("ModelsHeight"); }