public void Remove_Order_By_OrderId() { orderbook = new FullOrderbook(); var bid_orderId_1 = "bid_order_1"; var bid_isBid_1 = true; var bid_quantity_1 = 5; var bid_price_1 = 23; var bid_timestamp_1 = DateTimeOffset.Now; var bid_order_1 = new LimitOrder( bid_orderId_1, bid_isBid_1, bid_quantity_1, bid_price_1, bid_timestamp_1); var bid_orderId_2 = "bid_order_2"; var bid_isBid_2 = true; var bid_quantity_2 = 5; var bid_price_2 = 22; var bid_timestamp_2 = DateTimeOffset.Now; var bid_order_2 = new LimitOrder( bid_orderId_2, bid_isBid_2, bid_quantity_2, bid_price_2, bid_timestamp_2); var bid_orderId_3 = "bid_order_3"; var bid_isBid_3 = true; var bid_quantity_3 = 5; var bid_price_3 = 21; var bid_timestamp_3 = DateTimeOffset.Now; var bid_order_3 = new LimitOrder( bid_orderId_3, bid_isBid_3, bid_quantity_3, bid_price_3, bid_timestamp_3); var bid_orderId_4 = "bid_order_4"; var bid_isBid_4 = true; var bid_quantity_4 = 5; var bid_price_4 = 21; var bid_timestamp_4 = DateTimeOffset.Now; var bid_order_4 = new LimitOrder( bid_orderId_4, bid_isBid_4, bid_quantity_4, bid_price_4, bid_timestamp_4); var bid_orderId_5 = "bid_order_5"; var bid_isBid_5 = true; var bid_quantity_5 = 5; var bid_price_5 = 21; var bid_timestamp_5 = DateTimeOffset.Now; var bid_order_5 = new LimitOrder( bid_orderId_5, bid_isBid_5, bid_quantity_5, bid_price_5, bid_timestamp_5); orderbook.PlaceOrder(bid_order_1); orderbook.PlaceOrder(bid_order_2); orderbook.PlaceOrder(bid_order_3); orderbook.PlaceOrder(bid_order_4); orderbook.PlaceOrder(bid_order_5); var orderToRemove = new LimitOrder(); orderToRemove.SetOrderId(bid_order_3.OrderId); orderbook.RemoveOrderByOrderId(orderToRemove); //<1>. Should have 3 level of Bids, $23, $22, $21 //<2>. At level $21, there are two orders left, with Quantity 5 and 5. //<3>. TotalLevelQuantity at this level should be 10. //Assert <1> Assert.IsNotNull(orderbook.BestBidLevel); var bestBidLevels = orderbook.GetBestBidLevels(3); Assert.AreEqual(3, bestBidLevels.Count); Assert.AreEqual(23, bestBidLevels[0].LimitPrice); Assert.AreEqual(22, bestBidLevels[1].LimitPrice); Assert.AreEqual(21, bestBidLevels[2].LimitPrice); //Assert <2> var targetLevel = bestBidLevels[2]; Assert.AreEqual(2, targetLevel.NumberOfOrders); var firstBidOrderNode = targetLevel.Orders.List.First; Assert.IsNotNull(firstBidOrderNode); Assert.AreEqual(5, firstBidOrderNode.Value.Quantity); var secondBidOrderNode = firstBidOrderNode.Next; Assert.IsNotNull(secondBidOrderNode); Assert.AreEqual(5, secondBidOrderNode.Value.Quantity); //Assert <3> Assert.AreEqual(10, targetLevel.TotalLevelQuantity); }