public void testHandleBar() { Bar expectedExitBar = new Bar( 0x000000, new DateTime(2011, 2, 1), 100, 105, 99, 99, 1 ); positionMock.SetReturnValue("get_ExitBar", expectedExitBar); Bar bar = new Bar(0x000000, new DateTime(2011, 2, 2), 100, 105, 102, 103, 1); ProfitPerPeriod <Month> pnl = AnalyticTools.profitPerMonth((ISecurity)sourceMock.MockInstance); Assert.AreEqual(expectedExitBar, pnl.getLastExitBar()); }
public void testGetProfitPerList() { Bar expectedExitBar = new Bar( 0x000000, new DateTime(2011, 2, 1), 100, 105, 99, 99, 1 ); positionMock.SetReturnValue("get_ExitBar", expectedExitBar); positionMock.ExpectAndReturn("Profit", 100.0); Bar bar = new Bar(0x000000, new DateTime(2011, 2, 2), 100, 105, 102, 103, 1); ProfitPerPeriod <Month> pnl = AnalyticTools.profitPerMonth((ISecurity)sourceMock.MockInstance); List <double> actual = pnl.getProfitPerPeriodList(); Assert.AreEqual(1, actual.Count); Assert.AreEqual(100.0d, actual.Find(p => true)); }