public void testCanFailToRunCompleteSimulation() { Db.reallyRollback(); // open transaction system details insert (on unrelated row, jeff hates sqlserver) from DbTestCase causes test failure. var gui = new FakeResearchGUI(); gui.setMarkets(O.list("RE.TEST.TY.1C")); var parameters = new Parameters { { "ATRLen", 10 }, { "ATRlong", 100 }, { "BreakDays", 30 }, { "FixEquity", 1 }, { "InitEquity", 6000000 }, { "LeadBars", 50 }, { "MaxPyramid", 1 }, { "Risk", 0.02 }, { "nATR", 2 }, { "upATR", 2 }, { "systemId", 39 } // ok? }; gui.setParameters(parameters); gui.setStartDate(date("2001/01/01")); gui.setEndDate(date("2001/04/01")); gui.runSystem(); O.wait(() => gui.runButtonEnabled == false); O.wait(100, 100, gui.runComplete); IsTrue(gui.runButtonEnabled); gui.hasMessage("failed"); LogC.info("done"); }
static FakeResearchGUI initializeWorkingGui() { var gui = new FakeResearchGUI(); gui.setMarkets(O.list("RE.TEST.TY.1C")); var parameters = new Parameters { { "ATRLen", 10 }, { "ATRlong", 100 }, { "BreakDays", 30 }, { "FirstDayATR", 1 }, { "FixEquity", 1 }, { "InitEquity", 6000000 }, { "LeadBars", 50 }, { "MaxPyramid", 1 }, { "Risk", 0.02 }, { "nATR", 2 }, { "upATR", 2 }, { "systemId", 39 } // ok? }; gui.setParameters(parameters); gui.setStartDate(date("2001/01/01")); gui.setEndDate(date("2001/04/01")); gui.setRunInNativeCurrency(true); gui.runSystem(); return(gui); }
public void testCanFailToConstructSystemGracefully() { Db.reallyRollback(); // open transaction system details insert (on unrelated row, jeff hates sqlserver) from DbTestCase causes test failure. var gui = new FakeResearchGUI(); gui.setMarkets(O.list("RE.TEST.TY.1C")); gui.setParameters(new Parameters { { "systemId", 39 } }); gui.setStartDate(date("2001/01/01")); gui.setEndDate(date("2001/04/01")); gui.runSystem(); O.wait(() => gui.runButtonWasDisabled); O.wait(100, 100, gui.runComplete); IsTrue(gui.runButtonEnabled); IsNull(gui.researcher.simulator); gui.hasMessage("failed"); }