Inheritance: OrderMatchingEngine.OrderBook.Order
        public void WrongInstrumentThrowsException()
        {
            var order = new EquityOrder(999, Order.OrderTypes.GoodUntilCancelled,
                                        Order.BuyOrSell.Buy, 5, 10ul);

            Assert.Throws<ArgumentException>(() => m_BuyOrders.Insert(order));
        }
        public void WrongInstrumentThrowsException()
        {
            var order = new EquityOrder(new Instrument("WRONG"), Order.OrderTypes.GoodUntilCancelled,
                                        Order.BuyOrSell.Sell, 10, 10ul);

            Assert.Throws<ArgumentException>(() => m_SellOrders.Insert(order));
        }
        public void SubmitSellOrderTest()
        {
            var sellOrder = new EquityOrder(m_Instrument, Order.OrderTypes.LimitPrice, Order.BuyOrSell.Sell, 100, 100);
            m_Market.SubmitOrder(sellOrder);

            Assert.That(m_Market[m_Instrument].SellOrders[0], Is.EqualTo(sellOrder));
        }
        public void BigSellMatchesMultipleBuysTest()
        {
            var secondBuyOrder = new EquityOrder(m_Instrument, Order.OrderTypes.GoodUntilCancelled,
                                                 Order.BuyOrSell.Buy, 90, 100);
            m_BuyOrders.Insert(secondBuyOrder);
            m_SellOrder.Quantity = 150;
            Assert.True(OrderProcessor.TryMatchOrder(m_SellOrder, m_BuyOrders, m_Trades));

            Assert.That(m_TradeProcessor.Trades.Count, Is.EqualTo(2));
            Assert.That(m_BuyOrder.Quantity == 0);
            Assert.That(secondBuyOrder.Quantity == 50);
            Assert.That(m_BuyOrders[0] == secondBuyOrder && m_BuyOrders.Count() == 1);
        }
 public void Init()
 {
     m_Instrument = 1;
     m_BuyOrder = new EquityOrder(m_Instrument, Order.OrderTypes.GoodUntilCancelled, Order.BuyOrSell.Buy, 100,
                                  100ul);
     m_SellOrder = new EquityOrder(m_Instrument, Order.OrderTypes.GoodUntilCancelled, Order.BuyOrSell.Sell, 90,
                                   100ul);
     m_SellOrders = new SellOrders(m_Instrument);
     m_BuyOrders = new BuyOrders(m_Instrument);
     m_SellOrders.Insert(m_SellOrder);
     m_BuyOrders.Insert(m_BuyOrder);
     m_Trades = new Trades(m_Instrument);
     m_TradeProcessor = m_Trades.TradeProcessingStrategy as Trades.InMemoryTradeProcessor;
 }