Example #1
0
        public void MultiView_OnBubbleEvent()
        {
            Page           myPage = new Page();
            PokerMultiView pmv    = new PokerMultiView();
            View           v1     = new View();
            View           v2     = new View();

            pmv.Controls.Add(v1);
            pmv.Controls.Add(v2);
            pmv.ActiveViewIndex = 0;
            // Command NextView
            CommandEventArgs ceaNext = new CommandEventArgs("NextView", null);

            pmv.DoBubbleEvent(this, ceaNext);
            Assert.AreEqual(1, pmv.ActiveViewIndex, "BubbleEventNext ");
            // Command PrevView
            CommandEventArgs ceaPrev = new CommandEventArgs("PrevView", null);

            pmv.DoBubbleEvent(this, ceaPrev);
            Assert.AreEqual(0, pmv.ActiveViewIndex, "BubbleEventPrev");
            // Command SwitchViewByIndex
            CommandEventArgs ceaSwitch = new CommandEventArgs("SwitchViewByIndex", "1");

            pmv.DoBubbleEvent(this, ceaSwitch);
            Assert.AreEqual(1, pmv.ActiveViewIndex, "BubbleSwitchViewByIndex");
            // Command SwitchViewByID
            v1.ID = "v1";
            myPage.Controls.Add(pmv);                 // FindControl inherited from control & Page must exist
            CommandEventArgs ceaSwitchViewByID = new CommandEventArgs("SwitchViewByID", "v1");

            pmv.DoBubbleEvent(this, ceaSwitchViewByID);
            Assert.AreEqual(0, pmv.ActiveViewIndex, "SwitchViewByID");
        }
Example #2
0
		public void MultiView_OnBubbleEvent ()
		{
			Page myPage = new Page ();
			PokerMultiView pmv = new PokerMultiView ();
			View v1 = new View ();
			View v2 = new View ();
			pmv.Controls.Add (v1);
			pmv.Controls.Add (v2);
			pmv.ActiveViewIndex = 0;
			// Command NextView
			CommandEventArgs ceaNext = new CommandEventArgs ("NextView", null);
			pmv.DoBubbleEvent (this, ceaNext);
			Assert.AreEqual (1, pmv.ActiveViewIndex, "BubbleEventNext ");
			// Command PrevView
			CommandEventArgs ceaPrev = new CommandEventArgs ("PrevView", null);
			pmv.DoBubbleEvent (this, ceaPrev);
			Assert.AreEqual (0, pmv.ActiveViewIndex, "BubbleEventPrev");
			// Command SwitchViewByIndex
			CommandEventArgs ceaSwitch = new CommandEventArgs ("SwitchViewByIndex", "1");
			pmv.DoBubbleEvent (this, ceaSwitch);
			Assert.AreEqual (1, pmv.ActiveViewIndex, "BubbleSwitchViewByIndex");
			// Command SwitchViewByID
			v1.ID = "v1";
			myPage.Controls.Add (pmv);    // FindControl inherited from control & Page must exist
			CommandEventArgs ceaSwitchViewByID = new CommandEventArgs ("SwitchViewByID", "v1");
			pmv.DoBubbleEvent (this, ceaSwitchViewByID);
			Assert.AreEqual (0, pmv.ActiveViewIndex, "SwitchViewByID");
		}