Ejemplo n.º 1
0
        public void AddNewOrdersToOrderBook_SingleOrder_AddOneOrder()
        {
            ToyOrderBook.SetupOrderLists();
            string        newOrderString  = "2,2014 1 1 0 1,5";
            List <string> newOrderStrings = new List <string> ();

            newOrderStrings.Add(newOrderString);

            int ordersAdded   = ToyOrderBook.AddNewOrdersToOrderBook(newOrderStrings);
            int ordersPresent = ToyOrderBook.CountAllOrdersInBook();

            Assert.AreEqual(1, ordersAdded);
            Assert.AreEqual(1, ordersPresent);
        }
Ejemplo n.º 2
0
        public void RemoveOrder_SingleOrder_ShouldHaveNoOrderAfter(int toAdd, int toRemove, int resultingCount)
        {
            ToyOrderBook.SetupOrderLists();
            string        newOrderString  = "2,2014 1 1 0 1,5";
            List <string> newOrderStrings = new List <string> ();

            for (int i = 0; i < toAdd; i++)
            {
                newOrderStrings.Add(newOrderString);
            }

            ToyOrderBook.AddNewOrdersToOrderBook(newOrderStrings);

            for (int j = 0; j < toRemove; j++)
            {
                ToyOrder toyOrder = ToyOrderBook.orderLists [0] [0];
                ToyOrderBook.RemoveOrderFromBooks(toyOrder);
            }

            int ordersPresent = ToyOrderBook.CountAllOrdersInBook();

            Assert.AreEqual(resultingCount, ordersPresent);
        }