public static void TestGetMostTradedComm() { int[,] a = { { 0, 12 }, { 1, 10 }, { 2, 15 }, { 3, 14 }, { 4, 11 } }; int mostTradedComm = Statistics.GetMostTradedComm(a); Assert.AreEqual(4, mostTradedComm); //Because the sql sort the array before Statitistics gets array. }
// Trades the most traded commodity private void TradeMostTradedComm(int[,] marketShare) { int commID = Statistics.GetMostTradedComm(marketShare); TradeComm(this._commodities[commID], marketShare[marketShare.GetLength(0) - 1, 1]); }