예제 #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();
        }
    }
예제 #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);
    }
예제 #3
0
    public IPopUpConstArg CreateMockArg()
    {
        IPopUpConstArg arg = Substitute.For <IPopUpConstArg>();

        arg.popUpManager.Returns(Substitute.For <IPopUpManager>());
        arg.hidesOnTappingOthers.Returns(true);
        arg.popUpMode.Returns(PopUpMode.Alpha);

        return(arg);
    }
예제 #4
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();
    }
예제 #5
0
        public PopUp(IPopUpConstArg arg) : base(arg)
        {
            thisPopUpManager         = arg.popUpManager;
            thisHidesOnTappingOthers = arg.hidesOnTappingOthers;

            IPopUpStateEngineConstArg popUpStateEngineConstArg = new PopUpStateEngineConstArg(
                thisProcessFactory,
                this,
                thisPopUpManager,
                arg.popUpMode
                );

            thisStateEngine = new PopUpStateEngine(popUpStateEngineConstArg);
            if (arg.popUpMode == PopUpMode.Alpha)
            {
                this.GetUIAdaptor().SetUpCanvasGroupComponent();
            }
            GetPopUpAdaptor().ToggleRaycastBlock(false);
        }
예제 #6
0
 public TestPopUp(IPopUpConstArg arg) : base(arg)
 {
 }