public void TestGoodTradeList() { //Arrange MockDataStore mockDataStore = new MockDataStore(); List <Trade> trades = mockDataStore.GetMockedGoodTradeList(); //Act TradeLogicHelper tradeLogic = new TradeLogicHelper(); List <TradeResult> actualResult = tradeLogic.CalculateResult(trades); //Assert List <TradeResult> expectedResult = mockDataStore.GetMockedGoodTradeResult(); Assert.IsTrue(mockDataStore.TradeResultsAreEqual(expectedResult, actualResult)); }
private void CalculateTradesResult() { TradeLogicHelper tlhlp = new TradeLogicHelper(); //check if there is more than one item with same trade id if (tlhlp.CheckNotSameTradeId(TradesList)) { //here to check if there are any problems discovered after grouping //ex: some of the groups doesn't all have the same limits //ex: some of the groups doesn't all have the same number of trades.... List <TradingGroupStatus> tgStatuses = tlhlp.CheckGroupsError(TradesList); bool errorsFound = false; foreach (var item in tgStatuses) { if (!item.HasNoErrors) { logger.LogError(item.ErrorMessage); errorsFound = true; } } if (!errorsFound) { TradesResult = tlhlp.CalculateResult(TradesList); logger.LogInfoMessage($"Calculation Done. No errors found."); CalcGridVisible = true; } else { ErrorMsg = "The data is not good. Check server.log for detailed info."; } } else { ErrorMsg = "Two items has the same TradeId."; logger.LogError($"Two items has the same TradeId. remove one of them."); } }