示例#1
0
 public void InvalidConstructor_Test(string itemName, double price, string itemCatagory)
 {
     //arrange
     decimal priceAsDecimal = (decimal)price;
     //act
     VendingMachineSlot slot = new VendingMachineSlot(itemName, priceAsDecimal, itemCatagory);
 }
示例#2
0
        public void ItemCategory_test()
        {
            //arrange
            VendingMachineSlot slot = SetupHershys();

            //act

            //assert
            Assert.AreEqual("Candy", slot.ItemCategory);
        }
示例#3
0
        public void ItemName_Test()
        {
            //arrange
            VendingMachineSlot slot = SetupHershys();

            //act

            //assert
            Assert.AreEqual("Hershey's", slot.ItemName);
        }
示例#4
0
        public void Constructor_Test(string itemName, double price, string itemCatagory)
        {
            //arrange
            decimal priceAsDecimal = (decimal)price;
            //act
            VendingMachineSlot slot = new VendingMachineSlot(itemName, priceAsDecimal, itemCatagory);

            //assert
            Assert.AreEqual(priceAsDecimal, slot.Price, "The price of the slot was not set correctly. Check the constructor!");
        }
示例#5
0
        public void QuantityRemaining_test()
        {
            //arrange
            VendingMachineSlot slot = SetupHershys();

            //act
            slot.Pop();

            //assert
            Assert.AreEqual("4", slot.QuantityRemainingDisplayString);
        }
示例#6
0
        public void ToString_Test()
        {
            //arrange
            VendingMachineSlot slot = SetupHershys();

            //act

            string result = slot.ToString();

            //assert
            Assert.AreEqual("5|$2.00|Hershey's", result);
        }
示例#7
0
        public void ItemCategory_SoldOut_test()
        {
            //arrange
            VendingMachineSlot slot = SetupHershys();

            //act
            while (slot.Count > 0)
            {
                slot.Pop();//empty the slot
            }

            //assert
            Assert.AreEqual(null, slot.ItemCategory);
        }
示例#8
0
        public void QuantityRemaining_SoldOut_Test()
        {
            //arrange
            VendingMachineSlot slot = SetupHershys();

            //act
            while (slot.Count > 0)
            {
                slot.Pop();//empty the slot
            }

            //assert
            Assert.AreEqual(VendingMachineSlot.DISPLAY_QUANTITY_SOLD_OUT, slot.QuantityRemainingDisplayString);
        }
示例#9
0
        public void ToString_SoldOut_Test()
        {
            //arrange
            VendingMachineSlot slot = SetupHershys();

            //act
            while (slot.Count > 0)
            {
                slot.Pop();//empty the slot
            }
            string result = slot.ToString();

            //assert
            Assert.AreEqual($"{VendingMachineSlot.DISPLAY_QUANTITY_SOLD_OUT}|$2.00|Hershey's", result);
        }
 private MessageDataFiller Filler(IEntity shop, IInventoryPage page)
 {
     return(x =>
     {
         x.Identity = shop.Identity;
         x.Unknown = 1;
         List <VendingMachineSlot> tempList = new List <VendingMachineSlot>();
         foreach (IItem item in page.List().Values)
         {
             VendingMachineSlot temp = new VendingMachineSlot();
             temp.ItemHighId = item.HighID;
             temp.ItemLowId = item.LowID;
             temp.Quality = item.Quality;
             tempList.Add(temp);
         }
         x.VendingMachineSlots = tempList.ToArray();
     });
 }
示例#11
0
 public void Initialize()
 {
     vms       = new VendingMachineSlot();
     bubbleGum = new VendingMachineItem("Bubble Gum", 2.00M);
     candyBar  = new VendingMachineItem("Candy Bar", 2.50M);
 }