Example #1
0
    public void HideShownChildPopUpsRecursively_ChildIsActivated_ChildIsShown_CallsItInSequence()
    {
        IPopUpConstArg arg   = CreateMockArg();
        TestPopUp      popUp = new TestPopUp(arg);

        popUp.SetUpPopUpHierarchy();

        List <IPopUp> calledChildrent = new List <IPopUp>();

        for (int i = 0; i < 3; i++)
        {
            IPopUp childPopUp = Substitute.For <IPopUp>();
            childPopUp.IsActivated().Returns(true);
            childPopUp.IsShown().Returns(true);
            popUp.RegisterProximateChildPopUp(childPopUp);
            calledChildrent.Add(childPopUp);
        }
        List <IPopUp> notCalledChildren = new List <IPopUp>();

        for (int i = 0; i < 3; i++)
        {
            IPopUp childPopUp = Substitute.For <IPopUp>();
            childPopUp.IsActivated().Returns(false);
            childPopUp.IsShown().Returns(true);
            popUp.RegisterProximateChildPopUp(childPopUp);
            notCalledChildren.Add(childPopUp);
        }
        List <IPopUp> notCalledChildren2 = new List <IPopUp>();

        for (int i = 0; i < 3; i++)
        {
            IPopUp childPopUp = Substitute.For <IPopUp>();
            childPopUp.IsActivated().Returns(true);
            childPopUp.IsShown().Returns(false);
            popUp.RegisterProximateChildPopUp(childPopUp);
            notCalledChildren2.Add(childPopUp);
        }

        popUp.HideShownChildPopUpsRecursively();

        foreach (IPopUp childPopUp in calledChildrent)
        {
            childPopUp.Received(1).Hide(false);
            childPopUp.Received(1).HideShownChildPopUpsRecursively();
        }
        foreach (IPopUp childPopUp in notCalledChildren)
        {
            childPopUp.DidNotReceive().Hide(false);
            childPopUp.DidNotReceive().HideShownChildPopUpsRecursively();
        }
        foreach (IPopUp childPopUp in notCalledChildren2)
        {
            childPopUp.DidNotReceive().Hide(false);
            childPopUp.DidNotReceive().HideShownChildPopUpsRecursively();
        }
    }
Example #2
0
    public void IsAncestorOf_Child_ReturnsTrue()
    {
        IPopUpConstArg arg        = CreateMockArg();
        TestPopUp      popUp      = new TestPopUp(arg);
        IPopUp         childPopUp = Substitute.For <IPopUp>();

        childPopUp.GetProximateParentPopUp().Returns(popUp);

        Assert.That(popUp.IsAncestorOf(childPopUp), Is.True);
    }
Example #3
0
    public void ShowHiddenProximateParentPopUpRecursively_ProxParNotNull_ProxParIsHidden_CallsItInSequence()
    {
        IPopUpConstArg arg   = CreateMockArg();
        TestPopUp      popUp = new TestPopUp(arg);

        popUp.SetUpPopUpHierarchy();
        IPopUp parentPopUp = popUp.GetProximateParentPopUp();

        parentPopUp.IsHidden().Returns(true);

        popUp.ShowHiddenProximateParentPopUpRecursively();

        parentPopUp.Received(1).Show(false);
        parentPopUp.Received(1).ShowHiddenProximateParentPopUpRecursively();
    }