Ejemplo n.º 1
0
    public void EvaluatePickability_ThisIsEmpty_CallsEngineBecomeUnpickable()
    {
        IItemIconConstArg arg;
        IItemIcon         itemIcon = CreateTestItemIcon(out arg);
        IItemIconTransactionStateEngine iiTAStateEngine      = arg.iiTAStateEngine;
        IItemIconEmptinessStateEngine   emptinessStateEngine = arg.emptinessStateEngine;

        emptinessStateEngine.IsEmpty().Returns(true);
        Assert.That(itemIcon.IsEmpty(), Is.True);

        itemIcon.EvaluatePickability();

        iiTAStateEngine.Received(1).BecomeUnpickable();
    }
Ejemplo n.º 2
0
    public void IsEligibleForHover_ThisIsInSourceIG_ThisIsEmpty_ReturnsTrue()
    {
        IEquippableItemIconConstArg arg;
        TestEqpII           testEqpII   = CreateTestEqpII(out arg);
        IEquippableItemIcon pickedEqpII = Substitute.For <IEquippableItemIcon>();
        IIconGroup          thisIG      = Substitute.For <IIconGroup>();

        testEqpII.SetIconGroup(thisIG);
        pickedEqpII.GetIconGroup().Returns(thisIG);
        IItemIconEmptinessStateEngine emptinessStateEngine = arg.emptinessStateEngine;

        emptinessStateEngine.IsEmpty().Returns(true);

        Assert.That(testEqpII.TestIsEligibleForHover(pickedEqpII), Is.True);
    }
Ejemplo n.º 3
0
    public void IsEligibleForHover_ThisIsInDestIG_ThisIsNotEmpty_ThisDoesNotHaveSameItemTempAsPicked_ReturnsFalse()
    {
        IEquippableItemIconConstArg arg;
        TestEqpII               testEqpII   = CreateTestEqpII(quantity: 1, tempType: typeof(IBowTemplate), arg: out arg);
        IEquippableItemIcon     pickedEqpII = Substitute.For <IEquippableItemIcon>();
        IEquipToolEquippedBowIG thisEqpIG   = Substitute.For <IEquipToolEquippedBowIG>();

        testEqpII.SetIconGroup(thisEqpIG);
        IIconGroup otherIG = Substitute.For <IIconGroup>();

        pickedEqpII.GetIconGroup().Returns(otherIG);
        IItemIconEmptinessStateEngine emptinessStateEngine = arg.emptinessStateEngine;

        emptinessStateEngine.IsEmpty().Returns(false);
        pickedEqpII.GetItemTemplate().Returns(Substitute.For <IWearTemplate>());

        Assert.That(testEqpII.TestIsEligibleForHover(pickedEqpII), Is.False);
    }
Ejemplo n.º 4
0
    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);
    }
Ejemplo n.º 5
0
    public TestItemIcon CreateTestItemIcon(bool isEmpty, bool isReorderable, bool isTransferable, out IItemIconConstArg arg)
    {
        IItemIconConstArg             thisArg;
        TestItemIcon                  itemIcon             = CreateTestItemIcon(out thisArg);
        IItemIconEmptinessStateEngine emptinessStateEngine = thisArg.emptinessStateEngine;

        emptinessStateEngine.IsEmpty().Returns(isEmpty);
        IIconGroup ig = Substitute.For <IIconGroup>();

        itemIcon.SetIconGroup(ig);
        ig.GetSize().Returns(2);
        if (isReorderable)
        {
            ig.AllowsInsert().Returns(true);
        }
        else
        {
            ig.AllowsInsert().Returns(false);
        }
        thisArg.transferabilityHandlerImplementor.IsTransferable().Returns(isTransferable);

        arg = thisArg;
        return(itemIcon);
    }
Ejemplo n.º 6
0
 public bool IsEmpty()
 {
     return(thisEmptinessStateEngine.IsEmpty());
 }