Exemplo n.º 1
0
        public void CanRackIsEmptyTest()
        {
            int maxInventory = 5;
            var cr           = new CanRack(maxInventory);

            cr.FillTheCanRack();

            foreach (Flavor f in Enum.GetValues(typeof(Flavor)))
            {
                for (int i = maxInventory; i >= -1; i--)
                {
                    // While amount is at least 1 soda, rack is not empty
                    if (i >= 1)
                    {
                        Assert.IsFalse(cr.IsEmpty(f));
                    }
                    else
                    {
                        Assert.IsTrue(cr.IsEmpty(f));
                    }

                    cr.RemoveACanOf(f);
                }
            }
        }
Exemplo n.º 2
0
        public void CanRackFillCanRackTest()
        {
            var cr = new CanRack(3);

            cr.FillTheCanRack();
            foreach (Flavor f in Enum.GetValues(typeof(Flavor)))
            {
                // Check the filled canRack by flavor
                Assert.AreEqual(cr.Contents(f).Amount, 3);
            }
        }
Exemplo n.º 3
0
        public void CanRackEmptyRackOfTest()
        {
            var cr = new CanRack(3);

            cr.FillTheCanRack();

            // Empty each flavor and confirm amount is zero
            foreach (Flavor f in Enum.GetValues(typeof(Flavor)))
            {
                cr.EmptyCanRackOf(f);
                Assert.AreEqual(cr.Contents(f).Amount, 0);
            }
        }
Exemplo n.º 4
0
        public void CanRackRemoveACanOfTest()
        {
            int maxInventory = 3;
            var cr           = new CanRack(maxInventory);

            cr.FillTheCanRack();
            foreach (Flavor f in Enum.GetValues(typeof(Flavor)))
            {
                for (int i = maxInventory; i >= -1; i--)
                {
                    // Check inventory is decremented by 1 for each iteration but never less than 0
                    cr.RemoveACanOf(f);
                    Assert.AreEqual(cr.Contents(f).Amount, Math.Max(0, i - 1));
                }
            }
        }
Exemplo n.º 5
0
 private void FillTheCanRacks_Click(object sender, EventArgs e)
 {
     rack.FillTheCanRack();
     updateServiceViews();
 }
 private void buttonRefillCanRack_Click(object sender, EventArgs e)
 {
     sodaRack.FillTheCanRack();
     RefreshCanStockListBox();
 }