Пример #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
 void ToggePopUp()
 {
     if (thisTargetPopUp.IsShown())
     {
         thisTargetPopUp.Hide(false);
     }
     else
     {
         thisTargetPopUp.Show(false);
     }
 }
        public void TogglePopUp()
        {
            IPopUp popUp = (IPopUp)popUpAdaptor.GetUIElement();

            if (popUp.IsShown())
            {
                popUp.Hide(false);
            }
            else
            {
                popUp.Show(true);
            }
        }