Пример #1
0
        public void testCanPopulateDataTable()
        {
            var now = "2008/07/05 12:31:45";

            Dates.freezeNow(now);

            addOrders();
            var gui        = new FakeOrderTrackerGUI();
            var orderTable = gui.tracker.orderTable();

            gui.setMarket("RE.TEST.TY.1C");
            gui.doAllWork();
            var row = O.first(orderTable.rows());

            AreEqual("NDayBreak-daily-1.0", row["system"]);
            AreEqual("BFBD30", row["pv"]);
            AreEqual("RE.TEST.TY.1C", row["symbol"]);
            AreEqual(now, row["simFillTime"]);
            AreEqual("Enter short", row["enterExit"]);
            AreEqual("10,000", row["size"]);
            AreEqual("99.501235", row["simFillPrice"]);
            AreEqual("STOP(99.50)", row["details"]);
            AreEqual("an order", row["description"]);
            AreEqual("my pc", row["hostname"]);
        }
Пример #2
0
        static void assertStatus(FakeOrderTrackerGUI gui, OrderStatus expected)
        {
            var row = latestRow(gui);

            Bomb.unless(gui.statii.ContainsKey(row), () => "latest row has not been colored.");
            var color = gui.statii[row];

            AreEqual(expected, color);
        }
Пример #3
0
        public void testFilterBasedOnSiv()
        {
            addOrders();
            var gui        = new FakeOrderTrackerGUI();
            var orderTable = gui.tracker.orderTable();

            gui.selectedSystem = "NDayBreak-daily-1.0";
            gui.setMarket("RE.TEST.TY.1C");
            gui.doAllWork();
            AreEqual(2, orderTable.count());
            O.each(orderTable.rows(), row => AreEqual("NDayBreak-daily-1.0", row["system"]));
        }
Пример #4
0
        public void testUpdates()
        {
            addOrders();
            var gui = new FakeOrderTrackerGUI();

            gui.tracker.initialize();
            gui.setMarket("RE.TEST.TY.1C");
            gui.doAllWork();
            AreEqual(3, gui.count());
            addOrders();
            fireOrdersReceived();
            O.wait(() => { gui.doAllWork(); return(gui.count() == 6); });
            fireOrdersReceived();
            O.sleep(100);
            gui.doAllWork();
        }
Пример #5
0
        static FakeOrderTrackerGUI startGui()
        {
            OrderTable.prefix = "test";
            var gui = new FakeOrderTrackerGUI();
            var populateComplete = false;
            var lockObj          = new object();

            gui.tracker.orderTable().onPopulateComplete += () => { lock (lockObj) populateComplete = true; };
            populateCompleted = () => { lock (lockObj) { var result = populateComplete; populateComplete = false; return(result); } };
            gui.setMarket(SYMBOL);
            var tracker = gui.tracker;

            tracker.initialize();
            gui.wait(populateCompleted);
            return(gui);
        }
Пример #6
0
 static void publishAndWaitForCount(FakeOrderTrackerGUI gui, int id, int count)
 {
     publish(id);
     gui.waitMatches(count, () => gui.tracker.orderTable().count());
 }
Пример #7
0
 static DataRow latestRow(FakeOrderTrackerGUI gui)
 {
     return(O.first(gui.tracker.orderTable().rows()));
 }
Пример #8
0
 static void changeFerretStatus(FakeOrderTrackerGUI gui, string ferretId, string status, string expectedFerretOrderStatus, string destination)
 {
     publishFerretResponse(Dates.now(), ferretId, status, destination);
     gui.waitMatches(expectedFerretOrderStatus, () => gui.ferretStatus(ferretId));
 }
Пример #9
0
 static void changeFerretStatus(FakeOrderTrackerGUI gui, string ferretId, string status, string expectedFerretOrderStatus)
 {
     changeFerretStatus(gui, ferretId, status, expectedFerretOrderStatus, "UNSTATED_DESTINATION");
 }