public void TestWhenAChipItemIsConsumed()
        {
            ChipItem x      = new ChipItem("Lays", 75);
            string   result = x.Consume();

            Assert.AreEqual("Crunch Crunch, Yum!", result);
        }
Пример #2
0
        private void AddItemToList(string inLineItem)
        {
            // Split line on |
            string[] splitItems = inLineItem.Split("|");
            var      name       = splitItems[1];
            var      slotNumber = splitItems[0];
            var      price      = decimal.Parse(splitItems[2]);
            var      type       = splitItems[3];

            if (type == "Chip")
            {
                var chipItem = new ChipItem(name, slotNumber, price);
                Items.Add(slotNumber, chipItem);
            }
            else if (type == "Candy")
            {
                var candyItem = new CandyItem(name, slotNumber, price);
                Items.Add(slotNumber, candyItem);
            }
            else if (type == "Drink")
            {
                var drinkItem = new DrinkItem(name, slotNumber, price);
                Items.Add(slotNumber, drinkItem);
            }
            else if (type == "Gum")
            {
                var gumItem = new GumItem(name, slotNumber, price);
                Items.Add(slotNumber, gumItem);
            }
        }
Пример #3
0
        public void CheckIfConsumeReturnsString()
        {
            ChipItem chips = new ChipItem("Doritos", 2.00M);

            string result = chips.Consume();

            Assert.AreEqual("Crunch Crunch, Yum!", result);
        }
Пример #4
0
        public void Verify_ChipItem_MakeSound()
        {
            ChipItem testChip = new ChipItem("test", 1);

            string testSound = testChip.MakeSound();

            Assert.AreEqual("Crunch Crunch, Yum!", testSound);
        }
        public void CheckIfChipItemNameAndPriceExist()
        {
            ChipItem x     = new ChipItem("Lays", 145);
            string   item  = x.ItemName;
            decimal  price = x.Price;

            Assert.AreEqual("Lays", item);
            Assert.AreEqual(145, price);
        }
        public void DoesItCrunchCrunchYum()
        {
            // Arrange
            ChipItem tester = new ChipItem("test", 1);
            // Act
            string result = tester.Consume();

            // Assert
            Assert.AreEqual("Crunch Crunch, Yum!", result);
        }
        public void ChipItem()
        {
            string item = "";

            decimal price = 0.00M;

            ChipItem testClass = new ChipItem(item, price);

            string result = testClass.Consume();

            Assert.AreEqual("Crunch Crunch, Yum!", result);
        }
Пример #8
0
        /// <summary>
        /// Tries to remove chip.
        /// Execution is postponed to OnAfterRender, so this method cannot have a return value.
        /// </summary>
        public Task RemoveChipAsync(ChipItem chipToRemove)
        {
            // starts to edit the Model (the clone, to be precise)
            TModel newModelInEdit = CloneModel(Model);

            chipToRemove.RemoveAction(newModelInEdit); // process the chip removal
            ModelInEdit = newModelInEdit;              // place the model to the edit

            // propagate the model in edit to the Model and notify model changed
            // if used with await the chip is removed from UI much later
            _ = InvokeAsync(UpdateModelWithoutChipUpdateAsync);

            notifyChipsUpdatedAfterRender = true; // notify the chips update after the model is "rendered"
            StateHasChanged();                    // added as fix for #59236 HxListLayout/HxFilterForm - loses all chips, when one of chips gets removed

            return(Task.CompletedTask);
        }
Пример #9
0
 private void AddChipGo(int itemId, int property, int itemNum)
 {
     UnityEngine.GameObject go = CrossObjectHelper.TryCastObject <UnityEngine.GameObject>(ArkCrossEngine.ResourceSystem.GetSharedResource("UI/GamePokey/ChipCell"));
     go = NGUITools.AddChild(gridChip.gameObject, go);
     if (go != null)
     {
         // geng xin item
         ChipItem ci = go.GetComponent <ChipItem>();
         if (ci != null)
         {
             //int fs = (int)GetItemFightScore(item_data, append_property, 1);
             ci.SetItemInformation(itemId, property, itemNum);
             chipItemList.Add(ci);
         }
         ////记录物品id
         //ItemClick ic = go.GetComponent<ItemClick>();
         //if (ic != null) {
         //  ic.ID = itemId;
         //  //ic.PropertyId = append_property;
         //}
         //添加物品后更改控件名,便于后续工作
         go.transform.name = "Item" + itemcount++;
     }
 }
Пример #10
0
 private async Task HandleChipRemoveClick(ChipItem chipToRemove)
 {
     Console.WriteLine("HandleChipRemoveClick");
     await filterForm.RemoveChipAsync(chipToRemove);
 }
Пример #11
0
 public void Initialize()
 {
     chip = new ChipItem("CHIP_SLOT", "CHIP_NAME", 0.01M);
 }
Пример #12
0
 public void AddItem(int[] item, int[] item_num, int[] item_append_property)
 {
     try
     {
         if (isFirstInitItems)
         {
             wingIdList.Clear();
             RoleInfo roleInfo = LobbyClient.Instance.CurrentRole;
             if (roleInfo != null)
             {
                 ItemDataInfo[] equips = roleInfo.Equips;
                 if (equips != null)
                 {
                     foreach (ItemDataInfo info in equips)
                     {
                         ItemConfig config = ItemConfigProvider.Instance.GetDataById(info.ItemId);
                         if (config != null)
                         {
                             if (config.m_WearParts == 7)
                             {
                                 //wingIdList.Add(info.ItemId);// todo 暂时注释
                                 //AddWingGo(config, info.ItemId, info.RandomProperty, true);
                             }
                         }
                     }
                 }
             }
             isFirstInitItems = false;
         }
         int count = item.Length;
         for (int i = 0; i < count; ++i)
         {
             int itemcell = item[i];
             int itemNum  = item_num[i];
             ArkCrossEngine.ItemConfig item_data = ArkCrossEngine.ItemConfigProvider.Instance.GetDataById(itemcell);
             if (null != item_data)
             {
                 if (item_data.m_CanWear)
                 {
                     //if (item_data.m_WearParts == 7) {//翅膀// todo 暂时注释
                     //  if (wingIdList.IndexOf(itemcell) == -1) {
                     //    wingIdList.Add(itemcell);
                     //    AddWingGo(item_data, itemcell, item_append_property[i], true);
                     //  }
                     //} else {
                     AddEquipGo(item_data, itemcell, item_append_property[i]);
                     //}
                 }
                 else if (item_data.m_CompoundItemId.Count > 0 && item_data.m_CompoundItemId[0] > 0)
                 {//可合成
                     ChipItem ci = null;
                     foreach (ChipItem citem in chipItemList)
                     {
                         if (citem.Id() == itemcell)
                         {
                             ci = citem;
                         }
                     }
                     if (ci == null)
                     {
                         AddChipGo(itemcell, item_append_property[i], itemNum);
                     }
                     else
                     {
                         //update
                         ci.UpdateView(itemNum);
                     }
                     CheckHasCompound();
                 }
             }
         }
         if (gridEquip != null)
         {
             UIGridForDFM ug = gridEquip.gameObject.GetComponent <UIGridForDFM>();
             if (ug != null)
             {
                 ug.sortRepositionForDF = true;
             }
         }
         if (gridWingTop != null)
         {
             UIGridForDFM ug = gridWingTop.gameObject.GetComponent <UIGridForDFM>();
             if (ug != null)
             {
                 ug.sortRepositionForDF = true;
             }
         }
         if (gridChip != null)
         {
             UIGridForDFM ug = gridChip.gameObject.GetComponent <UIGridForDFM>();
             if (ug != null)
             {
                 ug.sortRepositionForDF = true;
             }
         }
     }
     catch (Exception ex)
     {
         ArkCrossEngine.LogicSystem.LogFromGfx("[Error]:Exception:{0}\n{1}", ex.Message, ex.StackTrace);
     }
 }
Пример #13
0
 private async Task HandleRemoveClick(ChipItem chipItemToRemove)
 {
     await InvokeOnChipRemoveClickAsync(chipItemToRemove);
 }
Пример #14
0
 /// <summary>
 /// Triggers the <see cref="OnChipRemoveClick"/> event. Allows interception of the event in derived components.
 /// </summary>
 protected virtual Task InvokeOnChipRemoveClickAsync(ChipItem chipRemoved) => OnChipRemoveClick.InvokeAsync(chipRemoved);
Пример #15
0
        public void ChipNameTest()
        {
            ChipItem chips = new ChipItem("Lays", 1.50M);

            Assert.AreEqual("Lays", chips.itemName);
        }
 public void Initialize()
 {
     testClass = new ChipItem("", 0.0M);
 }
Пример #17
0
        public void CandyConsumeTest()
        {
            ChipItem chips = new ChipItem("Lays", 1.50M);

            Assert.AreEqual("Crunch Crunch, Yum!", chips.Consume());
        }
Пример #18
0
        public void CandyPriceTest()
        {
            ChipItem chips = new ChipItem("Lays", 1.50M);

            Assert.AreEqual(150M, chips.priceInCents);
        }