Exemple #1
0
        public void ChooseToy_ToysWithDifferentDurationsAndStartTimes_PickEarliestToy()
        {
            List <string> orders = new List <string> ();

            orders.Add("1, 2014 1 4 8 0, 20");
            orders.Add("2, 2014 1 5 7 0, 40");
            orders.Add("3, 2014 1 4 9 0, 60");
            orders.Add("4, 2014 1 2 9 0, 601");
            orders.Add("5, 2014 1 2 12 0, 600");
            ToyOrderBook.SetupOrderLists();
            ToyOrderBook.AddNewOrdersToOrderBook(orders);

            ToyOrder shouldChooseToy = new ToyOrder("5, 2014 1 2 12 0, 600");

            Elf elf = new Elf(1);

            ToyOrder chosenToy = elf.ChooseToy();

            Assert.AreEqual(shouldChooseToy.iD, chosenToy.iD);
        }
Exemple #2
0
        public void ChooseToy_ToysWithDifferentDurationsAndStartTimes_PickQuickestAvailableToy()
        {
            List <string> orders = new List <string> ();

            orders.Add("1, 2014 1 1 8 0, 20");
            orders.Add("2, 2014 1 1 7 0, 40");
            orders.Add("3, 2014 1 1 9 0, 60");
            orders.Add("4, 2014 1 1 12 0, 10");
            orders.Add("5, 2014 1 1 9 0, 599");
            ToyOrderBook.SetupOrderLists();
            ToyOrderBook.AddNewOrdersToOrderBook(orders);

            ToyOrder shouldChooseToy;

            shouldChooseToy = new ToyOrder("1, 2014 1 1 8 0, 20");

            Elf elf = new Elf(1);

            ToyOrder chosenToy = elf.ChooseToy();

            Assert.AreEqual(shouldChooseToy.iD, chosenToy.iD);
        }