public void GetBestPrice_Buying_UnsuitableBalanceException() { decimal buyAmount = 4M; Order buyOrder = new BuyingOrder(buyAmount); Assert.Throws <Exception>(() => _marketHandler.ProcessOrder(buyOrder)); }
public void GetBestPrice_Buying_NegativeAmountFalse() { decimal buyAmount = -.74M; Order buyOrder = new BuyingOrder(buyAmount); Assert.Throws <Exception>(() => _marketHandler.ProcessOrder(buyOrder)); }
public void GetBestPrice_Buying_EqualTrue() { decimal buyAmount = 2.5M; Order buyOrder = new BuyingOrder(buyAmount); BestPrice bestBuy = _marketHandler.ProcessOrder(buyOrder); Assert.Equal(bestBuy.price, 870M); }
static void Main(string[] args) { MetaMarketHandler marketHandler = new MetaMarketHandler(); decimal amount = 4.25M; Order buyOrder = new BuyingOrder(amount); BestPrice bestBuy = marketHandler.ProcessOrder(buyOrder); Console.WriteLine(bestBuy); // without data resetting, previous sell/buy will impact on future results marketHandler.ResetData(); // if we wanna re-gather data and reset existing balances decimal sellAmount = 1.67M; Order sellOrder = new SellingOrder(sellAmount); BestPrice bestSell = marketHandler.ProcessOrder(sellOrder); Console.WriteLine(bestSell); }