public void Update_Order_Quantity() { orderbook = new FullOrderbook(); decimal newQty = 10; 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 = 23; 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 = 23; 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); orderbook.PlaceOrder(bid_order_1); orderbook.PlaceOrder(bid_order_2); orderbook.PlaceOrder(bid_order_3); var updated_bid_order_2 = bid_order_2.DeepCopyWithQtyChanged(newQty); orderbook.PlaceOrder(updated_bid_order_2); //<1>. Should have only one bid level. //<2>. At this level, the Quantities are 5, 10, 5. //Assert <1> Assert.IsNotNull(orderbook.BestBidLevel); var bestBidLevels = orderbook.GetBestBidLevels(3); Assert.AreSame(orderbook.BestBidLevel, bestBidLevels[0]); Assert.AreEqual(1, bestBidLevels.Count); Assert.AreEqual(23, bestBidLevels[0].LimitPrice); //Assert <2> Assert.AreEqual(3, orderbook.BestBidLevel.NumberOfOrders); var firstBidOrderNode = orderbook.BestBidLevel.Orders.List.First; Assert.IsNotNull(firstBidOrderNode); Assert.AreEqual(5, firstBidOrderNode.Value.Quantity); var secondBidOrderNode = firstBidOrderNode.Next; Assert.IsNotNull(secondBidOrderNode); Assert.AreEqual(newQty, secondBidOrderNode.Value.Quantity); var thirdBidOrderNode = secondBidOrderNode.Next; Assert.IsNotNull(thirdBidOrderNode); Assert.AreEqual(5, thirdBidOrderNode.Value.Quantity); Assert.AreEqual(20, orderbook.BestBidLevel.TotalLevelQuantity); }