public void HasSlotSpace_CurSizeLessThanMaxSize_ReturnsTrue(int iisSize, int maxSize)
    {
        IIconGroupConstArg arg;
        TestIG             testIG = CreateTestIG(iisSize, maxSize, out arg);
        List <IItemIcon>   iis    = CreateStubItemIcons(iisSize);

        testIG.SetItemIcons(iis);

        bool actualBool = testIG.HasSlotSpace();

        Assert.That(actualBool, Is.True);
    }
    public void HasSlotSpace_CurSizeEqualToMasSize_NoEmtpyIIs_ReturnsFalse(int iisCount, int[] emptyAt)
    {
        IIconGroupConstArg arg;
        TestIG             testIG = CreateTestIG(iisCount, iisCount, out arg);
        List <IItemIcon>   iis    = CreateStubItemIcons(iisCount, emptyAt);

        testIG.SetItemIcons(iis);

        bool actualBool = testIG.HasSlotSpace();

        Assert.That(actualBool, Is.False);
    }
    public void GetAllItemIconWithItemTemplate_NoMatch_ReturnsEmptyList(int[] quantities, int[] sameAt)
    {
        IIconGroupConstArg arg;
        TestIG             testIG         = CreateTestIG(quantities.Length, quantities.Length, out arg);
        IItemTemplate      sourceItemTemp = Substitute.For <IItemTemplate>();
        List <IItemIcon>   iis            = CreateStubItemIconsWithItemTempsMatchingAt(quantities, sameAt, sourceItemTemp);

        testIG.SetItemIcons(iis);

        List <IItemIcon> actualIIs = testIG.GetAllItemIconWithItemTemplate(sourceItemTemp);

        Assert.That(actualIIs, Is.Empty);
    }
    public void GetItemIconFromItem_MoreThanOneMatch_ReturnsFirstMatch(int[] quantities, int[] sameAt)
    {
        IIconGroupConstArg arg;
        TestIG             testIG     = CreateTestIG(quantities.Length, quantities.Length, out arg);
        IUIItem            sourceItem = Substitute.For <IUIItem>();
        List <IItemIcon>   iis        = CreateStubIIsWithItemsMatchingAt(quantities, sourceItem, sameAt);

        testIG.SetItemIcons(iis);

        IItemIcon actualII = testIG.GetItemIconFromItem(sourceItem);

        Assert.That(actualII, Is.EqualTo(iis[sameAt[0]]));
    }
    public void GetItemQuantity_WhenCalled_ReturnsSumOfAllSameItemQuantity(int[] quantities, int[] sameAt, int expectedQuantity)
    {
        IIconGroupConstArg arg;
        TestIG             testIG     = CreateTestIG(quantities.Length, quantities.Length, out arg);
        IUIItem            sourceItem = Substitute.For <IUIItem>();
        List <IItemIcon>   iis        = CreateStubIIsWithItemsMatchingAt(quantities, sourceItem, sameAt);

        testIG.SetItemIcons(iis);

        int actualQuantity = testIG.GetItemQuantity(sourceItem);

        Assert.That(actualQuantity, Is.EqualTo(expectedQuantity));
    }
    public TestIG CreateTestIG(int minSize, int maxSize, out IIconGroupConstArg arg)
    {
        IUIManager uim = Substitute.For <IUIManager>();
        IPickUpSystemProcessFactory   pickUpSystemProcessFactory   = Substitute.For <IPickUpSystemProcessFactory>();
        IPickUpSystemUIElementFactory pickUpSystemUIElementFactory = Substitute.For <IPickUpSystemUIElementFactory>();
        IPickUpSystemUIA            pickUpSystemUIA  = Substitute.For <IPickUpSystemUIA>();
        IUIImage                    image            = Substitute.For <IUIImage>();
        IUITool                     tool             = Substitute.For <IUITool>();
        IItemIconTransactionManager iiTAM            = Substitute.For <IItemIconTransactionManager>();
        IHoverPadsManager           hoverPadsManager = Substitute.For <IHoverPadsManager>();
        List <IItemIcon>            iis = new List <IItemIcon>();

        IIconGroupConstArg thisArg = new IconGroupConstArg(uim, pickUpSystemProcessFactory, pickUpSystemUIElementFactory, pickUpSystemUIA, image, tool, iiTAM, minSize, maxSize, hoverPadsManager, iis);
        TestIG             testIG  = new TestIG(thisArg);

        arg = thisArg;
        return(testIG);
    }
    public void GetAllItemIconWithItemTemplate_Matches_ReturnsAllMatches(int[] quantities, int[] sameAt)
    {
        IIconGroupConstArg arg;
        TestIG             testIG         = CreateTestIG(quantities.Length, quantities.Length, out arg);
        IItemTemplate      sourceItemTemp = Substitute.For <IItemTemplate>();
        List <IItemIcon>   iis            = CreateStubItemIconsWithItemTempsMatchingAt(quantities, sameAt, sourceItemTemp);

        testIG.SetItemIcons(iis);

        List <IItemIcon> actualIIs   = testIG.GetAllItemIconWithItemTemplate(sourceItemTemp);
        List <IItemIcon> expectedIIs = new List <IItemIcon>();

        foreach (int i in sameAt)
        {
            expectedIIs.Add(iis[i]);
        }

        Assert.That(actualIIs, Is.EquivalentTo(expectedIIs));
    }
Example #8
0
 public void Construction_MaxSizeEqualOrLesserThanMinSize_ThrowsException(int minSize, int maxSize)
 {
     IIconGroupConstArg arg;
     TestIG             testIG = CreateTestIG(minSize, maxSize, out arg);
 }
Example #9
0
 public void Construction_MaxSizeInvalid_ThrowsException([Values(0, -1, -100)] int maxSize)
 {
     IIconGroupConstArg arg;
     TestIG             testIG = CreateTestIG(0, maxSize, out arg);
 }