public void ConstructingControllerStartsTimelines()
        {
            var checkTimelines = new Mock<ITimer>();
            var updateTimelines = new Mock<ITimer>();
            var queue = new Queue<ITimer>();
            queue.Enqueue(checkTimelines.Object);
            queue.Enqueue(updateTimelines.Object);
            SysTimer.Override = queue.Dequeue;

            var timelines = new Mock<ITimelines>();
            var controller = new TimelineController(timelines.Object);
            controller.StartTimelines();
            checkTimelines.Raise(c => c.Elapsed += null, EventArgs.Empty);
            updateTimelines.Raise(u => u.Elapsed += null, EventArgs.Empty);

            checkTimelines.VerifySet(c => c.Interval = 100);
            checkTimelines.VerifySet(c => c.Interval = 60000);
            checkTimelines.Verify(c => c.Start());
            timelines.Verify(t => t.HomeTimeline());
            timelines.Verify(t => t.MentionsTimeline());

            updateTimelines.VerifySet(u => u.Interval = 30000);
            updateTimelines.Verify(u => u.Start());
            timelines.Verify(t => t.UpdateTimeStamps());
            Assert.That(controller, Is.Not.Null);
        }
예제 #2
0
        public void ConstructingControllerStartsTimelines()
        {
            var checkTimelines  = new Mock <ITimer>();
            var updateTimelines = new Mock <ITimer>();
            var queue           = new Queue <ITimer>();

            queue.Enqueue(checkTimelines.Object);
            queue.Enqueue(updateTimelines.Object);
            SysTimer.Override = queue.Dequeue;

            var timelines  = new Mock <ITimelines>();
            var controller = new TimelineController(timelines.Object);

            controller.StartTimelines();
            checkTimelines.Raise(c => c.Elapsed  += null, EventArgs.Empty);
            updateTimelines.Raise(u => u.Elapsed += null, EventArgs.Empty);

            checkTimelines.VerifySet(c => c.Interval = 100);
            checkTimelines.VerifySet(c => c.Interval = 60000);
            checkTimelines.Verify(c => c.Start());
            timelines.Verify(t => t.HomeTimeline());
            timelines.Verify(t => t.MentionsTimeline());

            updateTimelines.VerifySet(u => u.Interval = 30000);
            updateTimelines.Verify(u => u.Start());
            timelines.Verify(t => t.UpdateTimeStamps());
            Assert.That(controller, Is.Not.Null);
        }
        public void ConstructingControllerStartsTimelines()
        {
            var checkTimelines          = new Mock <ITimer>();
            var updateTimelines         = new Mock <ITimer>();
            var friendsBlockedTimelines = new Mock <ITimer>();
            var queue = new Queue <ITimer>();

            queue.Enqueue(checkTimelines.Object);
            queue.Enqueue(updateTimelines.Object);
            SysTimer.ImplementationOverride = queue.Dequeue;

            var timelines  = new Mock <ITimelines>();
            var controller = new TimelineController(timelines.Object);

            controller.StartTimelines();
            checkTimelines.Raise(c => c.Elapsed          += null, EventArgs.Empty);
            updateTimelines.Raise(u => u.Elapsed         += null, EventArgs.Empty);
            friendsBlockedTimelines.Raise(u => u.Elapsed += null, EventArgs.Empty);

            checkTimelines.VerifySet(c => c.Interval = 100);
            checkTimelines.VerifySet(c => c.Interval = 70000);
            checkTimelines.Verify(c => c.Start());
            timelines.Verify(t => t.UpdateHome());
            timelines.Verify(t => t.UpdateMentions());

            updateTimelines.VerifySet(u => u.Interval = 100);
            updateTimelines.VerifySet(u => u.Interval = 30000);
            updateTimelines.Verify(u => u.Start());
            timelines.Verify(t => t.UpdateTimeStamps());

            controller.Should().NotBeNull();
        }