IEquippableUIItem CreateStubItemFromTempTypeAndEquippedness(System.Type tempType, bool isEquipped) { IEquippableUIItem item = Substitute.For <IEquippableUIItem>(); if (tempType == typeof(IBowTemplate)) { IBowTemplate bowTemp = Substitute.For <IBowTemplate>(); item.GetItemTemplate().Returns(bowTemp); } else if (tempType == typeof(IWearTemplate)) { IWearTemplate wearTemp = Substitute.For <IWearTemplate>(); item.GetItemTemplate().Returns(wearTemp); } else { ICarriedGearTemplate carriedGearTemp = Substitute.For <ICarriedGearTemplate>(); item.GetItemTemplate().Returns(carriedGearTemp); } if (isEquipped) { item.IsEquipped().Returns(true); } else { item.IsEquipped().Returns(false); } return(item); }
public TestEqpII CreateTestEqpII(System.Type tempType, out IEquippableItemIconConstArg arg) { IEquippableItemIconConstArg thisArg; TestEqpII testEqpII = CreateTestEqpII(out thisArg); IEquippableUIItem item = (IEquippableUIItem)thisArg.item; if (tempType == typeof(IBowTemplate)) { item.GetItemTemplate().Returns(Substitute.For <IBowTemplate>()); } else if (tempType == typeof(IWearTemplate)) { item.GetItemTemplate().Returns(Substitute.For <IWearTemplate>()); } else if (tempType == typeof(ICarriedGearTemplate)) { item.GetItemTemplate().Returns(Substitute.For <ICarriedGearTemplate>()); } else { throw new System.ArgumentException("tempType must be of type IItemTemplate"); } arg = thisArg; return(testEqpII); }
public void EquipToolPoolIG_HasItemSpace_ValidTypeIsPassed_ReturnsTrue() { IIconGroupConstArg arg; EqpToolPoolIG eqpToolPoolIG = CreateEqpToolIG(2, 10, out arg); IEquippableUIItem eqpItem = Substitute.For <IEquippableUIItem>(); bool actualBool = eqpToolPoolIG.HasItemSpace(eqpItem); Assert.That(actualBool, Is.True); }
public TestEqpII CreateTestEqpII(int quantity, System.Type tempType, out IEquippableItemIconConstArg arg) { IEquippableItemIconConstArg thisArg; TestEqpII testEqpII = CreateTestEqpII(tempType, out thisArg); IEquippableUIItem eqpItem = (IEquippableUIItem)thisArg.item; eqpItem.GetQuantity().Returns(quantity); arg = thisArg; return(testEqpII); }
public override bool HasItemSpace(IUIItem item) { CheckPassedIUIItemTypeValidity(item); IEquippableUIItem eqpItem = item as IEquippableUIItem; //safe IItemTemplate itemTemp = eqpItem.GetItemTemplate(); if (itemTemp is IBowTemplate && !eqpItem.IsEquipped()) { return(true); } else { return(false); } }
public void IsEligibleForQuickDrop_ThisItemIsStackable_ThisHasSameItemAsHoveredEqpII_ReturnsFalse() { IEquippableItemIconConstArg arg; TestEqpII testEqpII = CreateTestEqpII(out arg); IUIItem item = arg.item; item.IsStackable().Returns(true); IEquippableItemIcon hoveredEqpII = Substitute.For <IEquippableItemIcon>(); IEquippableUIItem hoveredItem = Substitute.For <IEquippableUIItem>(); hoveredEqpII.GetEquippableItem().Returns(hoveredItem); item.IsSameAs(hoveredItem).Returns(true); ((IEquippableIITAManager)arg.iiTAM).GetHoveredEqpII().Returns(hoveredEqpII); Assert.That(testEqpII.TestIsEligibleForQuickDrop(), Is.False); }
public void EqpToolEqpCarriedGearIG_GetDefaultTATargetEqpII_HasSameItem_ReturnsIt(int[] sameAt) { IIconGroupConstArg arg; TestEqpToolEqpCGIG ig = CreateEqpToolEqpCarriedGearIG(0, 4, out arg); IEquippableItemIcon pickedEqpII = Substitute.For <IEquippableItemIcon>(); IEquippableUIItem pickedEqpItem = Substitute.For <IEquippableUIItem>(); pickedEqpII.GetUIItem().Returns(pickedEqpItem); List <IItemIcon> iisContainingSameItem = CreateStubEqpIIsWithSameItemAt(4, pickedEqpItem, sameAt); ig.SetItemIcons(iisContainingSameItem); IEquippableItemIcon actualEqpII = ig.GetDefaultTATargetEqpII(pickedEqpII); IItemIcon expectedII = iisContainingSameItem[sameAt[0]]; Assert.That(actualEqpII, Is.SameAs(expectedII)); }
public override bool HasItemSpace(IUIItem item) { CheckPassedIUIItemTypeValidity(item); IEquippableUIItem eqpItem = item as IEquippableUIItem; //safe IItemTemplate eqpItemTemp = eqpItem.GetItemTemplate(); if (eqpItemTemp is ICarriedGearTemplate) { int maxEquippableQuantity = eqpItem.GetMaxEquippableQuantity(); int equippedQuantity = this.GetItemQuantity(eqpItem); int space = maxEquippableQuantity - equippedQuantity; return(space > 0); } else { return(false); } }
public void IsEligibleForHover_ThisIsInSourceIG_ThisIsNotEmpty_ThisDoesNotHaveSameItemAsPickedEqpII_ReturnsFalse() { IEquippableItemIconConstArg arg; TestEqpII testEqpII = CreateTestEqpII(out arg); IEquippableItemIcon pickedEqpII = Substitute.For <IEquippableItemIcon>(); IIconGroup thisIG = Substitute.For <IIconGroup>(); testEqpII.SetIconGroup(thisIG); pickedEqpII.GetIconGroup().Returns(thisIG); IEquippableUIItem pickedEqpItem = Substitute.For <IEquippableUIItem>(); pickedEqpII.GetEquippableItem().Returns(pickedEqpItem); arg.item.IsSameAs(pickedEqpItem).Returns(false); IItemIconEmptinessStateEngine emptinessStateEngine = arg.emptinessStateEngine; emptinessStateEngine.IsEmpty().Returns(false); Assert.That(testEqpII.TestIsEligibleForHover(pickedEqpII), Is.False); }
/* */ public TestEqpII CreateTestEqpII(out IEquippableItemIconConstArg arg) { IEquippableItemIconConstArg thisArg = Substitute.For <IEquippableItemIconConstArg>(); IUIManager uim = Substitute.For <IUIManager>(); thisArg.uim.Returns(uim); IPickUpSystemProcessFactory pickUpSystemProcessFactory = Substitute.For <IPickUpSystemProcessFactory>(); thisArg.processFactory.Returns(pickUpSystemProcessFactory); IEquipToolUIEFactory eqpToolUIEFactory = Substitute.For <IEquipToolUIEFactory>(); thisArg.uiElementFactory.Returns(eqpToolUIEFactory); IEquippableItemIconAdaptor eqpIIUIA = Substitute.For <IEquippableItemIconAdaptor>(); thisArg.uia.Returns(eqpIIUIA); IItemIconImage itemIconImage = Substitute.For <IItemIconImage>(); thisArg.image.Returns(itemIconImage); IEquippableIITAManager eqpIITAM = Substitute.For <IEquippableIITAManager>(); thisArg.iiTAM.Returns(eqpIITAM); IEquippableUIItem eqpItem = Substitute.For <IEquippableUIItem>(); thisArg.item.Returns(eqpItem); IEqpIITransactionStateEngine eqpIITAStateEngine = Substitute.For <IEqpIITransactionStateEngine>(); thisArg.iiTAStateEngine.Returns(eqpIITAStateEngine); IItemIconEmptinessStateEngine emptinessStateEngine = Substitute.For <IItemIconEmptinessStateEngine>(); thisArg.emptinessStateEngine.Returns(emptinessStateEngine); IItemIconPickUpImplementor pickUpImplementor = Substitute.For <IItemIconPickUpImplementor>(); thisArg.iiPickUpImplementor.Returns(pickUpImplementor); arg = thisArg; TestEqpII eqpII = new TestEqpII(thisArg); return(eqpII); }
public EquippableItemIconAdaptorInitializationData(IEquippableUIItem equippableItem) { thisEquippableItem = equippableItem; }
public EquippableItemIconConstArg(IUIManager uim, IPickUpSystemProcessFactory pickUpSytemProcessFactory, IEquipToolUIEFactory eqpToolUIEFactory, IEquippableItemIconAdaptor uia, IItemIconImage itemIconImage, IEquipTool tool, IDragImageImplementor dragImageImplementor, IVisualPickednessStateEngine visualPickednessStateEngine, IEquippableIITAManager eqpIITAM, IEquippableUIItem item, IEqpIITransactionStateEngine eqpIITAStateEngine, IItemIconPickUpImplementor pickUpImplementor, IItemIconEmptinessStateEngine emptinessStateEngine, IEqpIITransferabilityHandlerImplementor eqpIITransferabilityHandlerImplementor, IQuantityRoller quantityRoller) : base(uim, pickUpSytemProcessFactory, eqpToolUIEFactory, uia, itemIconImage, tool, dragImageImplementor, visualPickednessStateEngine, eqpIITAM, item, eqpIITAStateEngine, pickUpImplementor, emptinessStateEngine, eqpIITransferabilityHandlerImplementor, quantityRoller) { }