예제 #1
0
        public void CheckPlaceOrder_Tests(int clientId, double price, int quantity, bool isBuy, bool result)
        {
            var  data         = GetOrderData(clientId, price, quantity, isBuy);
            bool notAvailable = false;

            if (isBuy)
            {
                notAvailable = !_order.GetOrderData().BuyPendingOrders.Contains(data);
            }
            else
            {
                notAvailable = !_order.GetOrderData().SellPendingOrders.Contains(data);
            }

            _order.AddOrderIntoQueue(data);
            Thread.Sleep(2000);
            if (isBuy)
            {
                bool isOrderPlaced = _order.GetOrderData().BuyPendingOrders.Contains(data);
                Assert.AreEqual((isOrderPlaced && notAvailable), result);
            }
            else
            {
                bool isOrderPlaced = _order.GetOrderData().SellPendingOrders.Contains(data);
                Assert.AreEqual((isOrderPlaced && notAvailable), result);
            }
            Thread.Sleep(1000);
        }