예제 #1
0
        public void EquippableCharacterEquipAtTests()
        {
            var equipped = _equippableCharacter.EquipAt(0, _headItem, 1);

            Assert.IsNull(equipped.error);
            Assert.AreEqual(1, equipped.result.equippedAmount);
            Assert.AreSame(_headItem, equipped.result.equippedItem);
            Assert.AreEqual(0, equipped.result.index);

            Assert.AreEqual(_headItem, _equipmentCollection[0]);
            Assert.AreEqual(1, _equipmentCollection.GetAmount(0));
        }
예제 #2
0
        public void SwapStackable()
        {
            var col         = new CollectionAccessibleMethods <IItemInstance>(10);
            var arrowsClone = (MockedEquippableItemInstance)_arrowsItem.Clone();

            var set     = col.Set(0, _arrowsItem, 5);
            var set2    = _character.EquipAt(4, arrowsClone, 2);
            var swapped = col.SwapPublic(0, _equipmentCollection, 4);

            Assert.IsNull(set.error);
            Assert.IsNull(set2.error);
            Assert.IsNull(swapped.error);

            Assert.AreSame(arrowsClone, col[0]);
            Assert.AreSame(_arrowsItem, _equipmentCollection[4]);

            // Events aren't fired because we don't use the IEquippableCharacter, and move to the collection directly.
            Assert.AreEqual(0, _arrowsItem.onEquippedCallCount);
            Assert.AreEqual(0, _arrowsItem.onUnEquippedCallCount);

            Assert.AreEqual(1, arrowsClone.onEquippedCallCount);
            Assert.AreEqual(0, arrowsClone.onUnEquippedCallCount);
        }
예제 #3
0
        public void EquipAtWrongSlotTest()
        {
            _restoreToCollection.Set(0, _arrowsItem);
            var equipped = _equippableCharacter.EquipAt(1, _arrowsItem);

            Assert.AreEqual(Errors.CharacterCollectionEquipmentTypeInvalid, equipped.error);
            Assert.IsNull(_equipmentCollection[0]);
            Assert.AreEqual(0, _equipmentCollection.GetAmount(_arrowsItem));
            Assert.AreSame(_arrowsItem, _restoreToCollection[0]);
            Assert.AreEqual(1, _restoreToCollection.GetAmount(_arrowsItem));
        }