Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }