Пример #1
0
        public void OnItemBoxUpdateTest(List <sItem> inititalList, List <sItem> refreshedList, bool eventTriggered)
        {
            var box       = new ItemBox();
            var triggered = false;

            sItem[] empty = { };
            box.Refresh(inititalList.ToArray(), empty, empty, empty);
            box.OnItemBoxUpdate += (sender, args) => { triggered = true; };

            box.Refresh(refreshedList.ToArray(), empty, empty, empty);

            Assert.AreEqual(eventTriggered, triggered);
        }
Пример #2
0
        public void FindItemsInTabTest(List <sItem> consumables, HashSet <int> ids, HashSet <int> expectedIds)
        {
            var box = new ItemBox();

            sItem[] empty = {  };
            box.Refresh(consumables.ToArray(), empty, empty, empty);
            var actualItems = ItemBox.FindItemsInTab(box.Consumables, ids);

            Assert.NotNull(actualItems);
            CollectionAssert.AreEquivalent(expectedIds, actualItems.Keys);
        }
Пример #3
0
        public void FindItemsInBoxTest(List <sItem> consumables,
                                       List <sItem> ammo,
                                       List <sItem> materials,
                                       List <sItem> decorations,
                                       HashSet <int> ids,
                                       HashSet <int> expectedIds)
        {
            var box = new ItemBox();

            box.Refresh(consumables.ToArray(), ammo.ToArray(), materials.ToArray(), decorations.ToArray());
            var actualItems = box.FindItemsInBox(ids);

            CollectionAssert.AreEquivalent(expectedIds, actualItems.Keys);
        }
Пример #4
0
        public void DuplicatesShouldDiscarded()
        {
            sItem[] dups =
            {
                new sItem {
                    ItemId = 1, Amount = 900
                },
                new sItem {
                    ItemId = 1, Amount = 99
                },
            };

            var box = new ItemBox();

            sItem[] empty = { };
            box.Refresh(dups, empty, empty, empty);
            Assert.AreEqual(900, box.Consumables[1]);
        }