Ejemplo n.º 1
0
        public void testIntermingledTicks()
        {
            O.freezeNow("2008/08/08 11:00:00");
            StatusTracker.LATE_MILLIS    = 1000;
            StatusTracker.CRASHED_MILLIS = 1000;
            var tracker = startGui();

            message("2008/08/08 11:01:00", "2008/08/08 10:00:00");
            waitForTickStatus(SystemStatus.GREEN);
            SYMBOL.publish(new Bar(0, 0, 0, 0, date("2008/08/08 11:00:00")));
            O.wait(() => tracker.tickTimers[system].running());
            O.advanceNow(1000);
            waitForTickStatus(SystemStatus.YELLOW);
            SYMBOL.publish(new Bar(0, 0, 0, 0, date("2008/08/08 11:00:01")));
            O.wait(() => tracker.plans[system].Count == 2);
            O.advanceNow(1000);
            waitForTickStatus(SystemStatus.RED);
            message("2008/08/08 11:01:00", "2008/08/08 11:00:00");
            waitForTickStatus(SystemStatus.YELLOW);
            O.advanceNow(1000);
            waitForTickStatus(SystemStatus.RED);
            SYMBOL.publish(new Bar(0, 0, 0, 0, date("2008/08/08 11:00:03")));
            message("2008/08/08 11:01:00", "2008/08/08 11:00:03");
            waitForTickStatus(SystemStatus.GREEN);
        }
Ejemplo n.º 2
0
 public void testHeartBeat()
 {
     StatusTracker.LATE_MILLIS    = 500;
     StatusTracker.CRASHED_MILLIS = 500;
     O.freezeNow("2008/08/08 11:00:00");
     startGui();
     message("2008/08/08 11:00:00", "2008/08/08 10:00:00");
     waitForHeartbeatStatus(SystemStatus.GREEN);
     O.advanceNow(500);
     waitForHeartbeatStatus(SystemStatus.YELLOW);
     O.advanceNow(500);
     waitForHeartbeatStatus(SystemStatus.RED);
 }
Ejemplo n.º 3
0
        public void testTimerSequence()
        {
            Objects.freezeNow("2008/11/11 11:11:11");
            double currentState = -1;
            var    sequence     = new TimerSequence <double>(d => { currentState = d; });

            sequence.add(1.1, 500);
            sequence.add(2.2, 500);
            sequence.add(3.3);
            IsFalse(sequence.running());
            // starts in 1.1
            sequence.startAsOf(O.now());
            O.wait(() => currentState == 1.1);
            IsTrue(sequence.running());
            Objects.advanceNow(500);
            O.wait(() => currentState == 2.2);
            Objects.advanceNow(500);
            O.wait(() => currentState == 3.3);
            IsFalse(sequence.running());

            sequence.startAsOf(O.now());
            O.wait(() => currentState == 1.1);
            Objects.advanceNow(500);
            O.wait(() => currentState == 2.2);
            sequence.startAsOf(O.now());
            O.wait(() => currentState == 1.1);
            Objects.advanceNow(500);
            O.wait(() => currentState == 2.2);
            Objects.advanceNow(500);
            O.wait(() => currentState == 3.3);

            // starts in 2.2
            var asOf = O.now();

            Objects.advanceNow(500);
            sequence.startAsOf(asOf);
            O.wait(() => currentState == 2.2);
            Objects.advanceNow(500);
            O.wait(() => currentState == 3.3);

            // starts in 3.3
            asOf         = O.now();
            currentState = -1;
            Objects.advanceNow(1000);
            sequence.startAsOf(asOf);
            O.wait(() => currentState == 3.3);
        }
Ejemplo n.º 4
0
        public void testTick()
        {
            O.freezeNow("2008/08/08 11:00:00");
            StatusTracker.LATE_MILLIS    = 500;
            StatusTracker.CRASHED_MILLIS = 500;
            var tracker = startGui();

            AreEqual(SystemStatus.UNKNOWN, gui.tickStatus(system));
            message("2008/08/08 11:00:00", "2008/08/08 10:00:00");
            waitForTickStatus(SystemStatus.GREEN);
            O.advanceNow(1000);

            Log.setFile(@"C:\foo.log");
            SYMBOL.publish(new Bar(0, 0, 0, 0, date("2008/08/08 11:00:01")));
            O.wait(() => tracker.tickTimers[system].running());
            O.advanceNow(500);
            waitForTickStatus(SystemStatus.YELLOW);
            O.advanceNow(500);
            waitForTickStatus(SystemStatus.RED);
            O.advanceNow(59000);
            message("2008/08/08 11:01:00", "2008/08/08 11:00:01");
            waitForTickStatus(SystemStatus.GREEN);
            // lastTickProcessed should be the time on the tick
        }