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_Render()
        {
            PokerMultiView b    = new PokerMultiView();
            string         html = b.Render();

            Assert.AreEqual(b.Render(), string.Empty, "DefaultRender");
        }
Example #3
0
        public void MultiView_AddParsedSubObjectExeption2()
        {
            PokerMultiView pmv = new PokerMultiView();
            LiteralControl l1  = new LiteralControl("literal");

            pmv.DoAddParsedSubObject(l1);
        }
Example #4
0
        public void MultiView_AddParsedSubObject()
        {
            PokerMultiView pmv = new PokerMultiView();
            View           v1  = new View();

            pmv.DoAddParsedSubObject(v1);
            Assert.AreEqual(1, pmv.Controls.Count, "AddParsedSubObjectSuccssed");
        }
Example #5
0
        public void MultiView_IndexOutRange()
        {
            PokerMultiView pmw = new PokerMultiView();
            View           pv1 = new View();

            pmw.Controls.Add(pv1);
            pmw.SetActiveView(pv1);
            pmw.ActiveViewIndex = 7;
        }
Example #6
0
        public void MultiView_AddViews()
        {
            PokerMultiView pmv = new PokerMultiView();
            View           v1  = new View();

            pmv.Controls.Add(v1);
            Assert.AreEqual(1, pmv.Views.Count, "ViewsCount");
            Assert.AreEqual(-1, pmv.ActiveViewIndex, "ActiveViewIndex");
        }
Example #7
0
        public void MultiView_Events()
        {
            PokerMultiView pmv = new PokerMultiView();

            pmv.ActiveViewChanged += new EventHandler(OnActiveViewChangedHandler);
            Assert.AreEqual(false, OnActiveChanged, "OnActiveChanged");
            pmv.DoOnActiveViewChanged(new EventArgs());
            Assert.AreEqual(true, OnActiveChanged, "AfterOnActiveChanged");
        }
Example #8
0
        public void MultiView_SetActiveView()
        {
            PokerMultiView pmw = new PokerMultiView();
            PokerView      pv1 = new PokerView();

            pmw.Controls.Add(pv1);
            pmw.SetActiveView(pv1);
            Assert.AreEqual(pv1, pmw.GetActiveView(), "GetActiveView");
            Assert.AreEqual(1, pmw.Controls.Count, "MultiViewControlsCount");
        }
Example #9
0
        public void MultiView_ActiveIndex()
        {
            PokerMultiView pmv    = new PokerMultiView();
            View           myView = new View();

            Assert.AreEqual(-1, pmv.ActiveViewIndex, "ActiveViewIndexDefault");
            pmv.ActiveViewIndex = 0;
            Assert.AreEqual(0, pmv.ActiveViewIndex, "ActiveViewIndexChange");
            pmv.Controls.Remove(myView);
            Assert.AreEqual(0, pmv.Controls.Count, "ControlsCount");
            Assert.AreEqual(0, pmv.ActiveViewIndex, "ActiveViewIndexRemove");
        }
Example #10
0
        public void MultiView_DefaultProperties()
        {
            PokerMultiView pmw = new PokerMultiView();

            Assert.AreEqual(0, pmw.StateBag.Count, "ViewState.Count");
            Assert.AreEqual(-1, pmw.ActiveViewIndex, "ActiveViewIndex");
            Assert.AreEqual(0, pmw.Views.Count, "DefaultZeroViews");
            Assert.AreEqual(PokerMultiView.NextViewCommandName, "NextView", "DefaultNextViewCommandName");
            Assert.AreEqual(PokerMultiView.PreviousViewCommandName, "PrevView", "DefaultPrevViewCommandName");
            Assert.AreEqual(PokerMultiView.SwitchViewByIDCommandName, "SwitchViewByID", "SwitchViewByIDCommandName");
            Assert.AreEqual(PokerMultiView.SwitchViewByIndexCommandName, "SwitchViewByIndex", "SwitchViewByIndexCommandName");
        }
Example #11
0
        public void MultiView_ButtonRender()
        {
            PokerMultiView m = new PokerMultiView();
            PokerView      v = new PokerView();
            Button         b = new Button();

            b.ID = "test";
            v.Controls.Add(b);
            m.Controls.Add(v);
            m.SetActiveView(v);
            string html = m.Render();

            Assert.AreEqual("<input type=\"submit\" name=\"test\" value=\"\" id=\"test\" />", html, "ButtonRender");
        }
Example #12
0
        public void MultiView_RemoveViewControlEvent()
        {
            PokerMultiView pmv = new PokerMultiView();
            View           pv1 = new View();
            View           pv2 = new View();
            View           pv3 = new View();

            pmv.Controls.Add(pv1);
            pmv.Controls.Add(pv2);
            pmv.Controls.Add(pv3);
            pmv.SetActiveView(pv1);
            Assert.AreEqual(0, pmv.ActiveViewIndex, "MultiViewActiveView");
            Assert.AreEqual(3, pmv.Controls.Count, "MultiViewControlsCount1");
            pmv.Controls.Remove(pv1);
            Assert.AreEqual(2, pmv.Controls.Count, "MultiViewControlsCount2");
            // Protected method MultiView RemovedControl has changed active view to next
            Assert.AreSame(pv2, pmv.GetActiveView(), "EventRemovedControl");
        }
Example #13
0
        public void MultiView_ControlState()
        {
            PokerMultiView pmv = new PokerMultiView();
            View           v1  = new View();
            View           v2  = new View();
            View           v3  = new View();

            pmv.AddViewCtrl(v1);
            pmv.AddViewCtrl(v2);
            pmv.AddViewCtrl(v3);
            pmv.SetActiveView(v1);
            Assert.AreEqual(v1, pmv.GetActiveView(), "BeforeLoadState");
            object state = pmv.SaveState();

            pmv.SetActiveView(v2);
            Assert.AreEqual(1, pmv.ActiveViewIndex, "AftreSetActiveViewChanged");
            pmv.LoadState(state);
            Assert.AreEqual(0, pmv.ActiveViewIndex, "AftreLoadState");
        }
Example #14
0
        public void MultiView_SomeViewsButtonRender()
        {
            PokerMultiView m  = new PokerMultiView();
            View           v  = new View();
            View           v1 = new View();
            Button         b  = new Button();
            Button         b1 = new Button();

            b1.ID = "test1";
            b.ID  = "test";
            v.Controls.Add(b);
            v1.Controls.Add(b1);
            m.Controls.Add(v);
            m.Controls.Add(v1);
            m.SetActiveView(v);
            Assert.AreEqual(m.Render(), "<input type=\"submit\" name=\"test\" value=\"\" id=\"test\" />", "ViewWithButtonRender");
            m.SetActiveView(v1);
            Assert.AreEqual(m.Render(), "<input type=\"submit\" name=\"test1\" value=\"\" id=\"test1\" />", "ChangeViewButtonRender");
        }
Example #15
0
		public void MultiView_ButtonRender ()
		{
			PokerMultiView m = new PokerMultiView ();
			PokerView v = new PokerView ();
			Button b = new Button ();
			b.ID = "test";
			v.Controls.Add (b);
			m.Controls.Add (v);
			m.SetActiveView (v);
			string html = m.Render ();
			Assert.AreEqual ("<input type=\"submit\" name=\"test\" value=\"\" id=\"test\" />", html, "ButtonRender");
		}
Example #16
0
		public void MultiView_Render ()
		{
			PokerMultiView b = new PokerMultiView ();
			string html = b.Render ();
			Assert.AreEqual (b.Render (), string.Empty, "DefaultRender");
		}
Example #17
0
		public void MultiView_CreateControlCollection ()
		{
			PokerMultiView pmv = new PokerMultiView ();
			Assert.IsNotNull (pmv.Views, "CreatingViewCollection");
		}
Example #18
0
		public void MultiView_AddParsedSubObject ()
		{
			PokerMultiView pmv = new PokerMultiView ();
			View v1 = new View ();
			pmv.DoAddParsedSubObject (v1);
			Assert.AreEqual (1, pmv.Controls.Count, "AddParsedSubObjectSuccssed");
		}
Example #19
0
		public void MultiView_RemoveViewControlEvent ()
		{
			PokerMultiView pmv = new PokerMultiView ();
			View pv1 = new View ();
			View pv2 = new View ();
			View pv3 = new View ();
			pmv.Controls.Add (pv1);
			pmv.Controls.Add (pv2);
			pmv.Controls.Add (pv3);
			pmv.SetActiveView (pv1);
			Assert.AreEqual (0, pmv.ActiveViewIndex, "MultiViewActiveView");
			Assert.AreEqual (3, pmv.Controls.Count, "MultiViewControlsCount1");
			pmv.Controls.Remove (pv1);
			Assert.AreEqual (2, pmv.Controls.Count, "MultiViewControlsCount2");
			// Protected method MultiView RemovedControl has changed active view to next 
			Assert.AreSame (pv2, pmv.GetActiveView (), "EventRemovedControl");

		}
Example #20
0
		public void MultiView_Events ()
		{
			PokerMultiView pmv = new PokerMultiView ();
			pmv.ActiveViewChanged += new EventHandler (OnActiveViewChangedHandler);
			Assert.AreEqual (false, OnActiveChanged, "OnActiveChanged");
			pmv.DoOnActiveViewChanged (new EventArgs ());
			Assert.AreEqual (true, OnActiveChanged, "AfterOnActiveChanged");

		}
Example #21
0
		public void MultiView_AddViews ()
		{
			PokerMultiView pmv = new PokerMultiView ();
			View v1 = new View ();
			pmv.Controls.Add (v1);
			Assert.AreEqual (1, pmv.Views.Count, "ViewsCount");
			Assert.AreEqual (-1, pmv.ActiveViewIndex, "ActiveViewIndex");
		}
Example #22
0
		public void MultiView_NotWorkingDefaultProperties ()
		{
			PokerMultiView pmw = new PokerMultiView ();
			Assert.IsTrue (pmw.EnableTheming, "EnableTheming");

		}
Example #23
0
        public void MultiView_NotWorkingDefaultProperties()
        {
            PokerMultiView pmw = new PokerMultiView();

            Assert.IsTrue(pmw.EnableTheming, "EnableTheming");
        }
Example #24
0
		public void MultiView_IndexOutRange ()
		{
			PokerMultiView pmw = new PokerMultiView ();
			View pv1 = new View ();
			pmw.Controls.Add (pv1);
			pmw.SetActiveView (pv1);
			pmw.ActiveViewIndex = 7;

		}
Example #25
0
        public void MultiView_CreateControlCollection()
        {
            PokerMultiView pmv = new PokerMultiView();

            Assert.IsNotNull(pmv.Views, "CreatingViewCollection");
        }
Example #26
0
		public void MultiView_SomeViewsButtonRender ()
		{
			PokerMultiView m = new PokerMultiView ();
			View v = new View ();
			View v1 = new View ();
			Button b = new Button ();
			Button b1 = new Button ();
			b1.ID = "test1";
			b.ID = "test";
			v.Controls.Add (b);
			v1.Controls.Add (b1);
			m.Controls.Add (v);
			m.Controls.Add (v1);
			m.SetActiveView (v);
			Assert.AreEqual (m.Render (), "<input type=\"submit\" name=\"test\" value=\"\" id=\"test\" />", "ViewWithButtonRender");
			m.SetActiveView (v1);
			Assert.AreEqual (m.Render (), "<input type=\"submit\" name=\"test1\" value=\"\" id=\"test1\" />", "ChangeViewButtonRender");

		}
Example #27
0
		public void MultiView_ControlState ()
		{
			PokerMultiView pmv = new PokerMultiView ();
			View v1 = new View ();
			View v2 = new View ();
			View v3 = new View ();
			pmv.AddViewCtrl (v1);
			pmv.AddViewCtrl (v2);
			pmv.AddViewCtrl (v3);
			pmv.SetActiveView (v1);
			Assert.AreEqual (v1, pmv.GetActiveView (), "BeforeLoadState");
			object state = pmv.SaveState ();
			pmv.SetActiveView (v2);
			Assert.AreEqual (1, pmv.ActiveViewIndex, "AftreSetActiveViewChanged");
			pmv.LoadState (state);
			Assert.AreEqual (0, pmv.ActiveViewIndex, "AftreLoadState");

		}
Example #28
0
		public void MultiView_ActiveIndex ()
		{
			PokerMultiView pmv = new PokerMultiView ();
			View myView = new View ();
			Assert.AreEqual (-1, pmv.ActiveViewIndex, "ActiveViewIndexDefault");
			pmv.ActiveViewIndex = 0;
			Assert.AreEqual (0, pmv.ActiveViewIndex, "ActiveViewIndexChange");
			pmv.Controls.Remove (myView);
			Assert.AreEqual (0, pmv.Controls.Count, "ControlsCount");
			Assert.AreEqual (0, pmv.ActiveViewIndex, "ActiveViewIndexRemove");
		}
Example #29
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 #30
0
		public void MultiView_SetActiveView ()
		{
			PokerMultiView pmw = new PokerMultiView ();
			PokerView pv1 = new PokerView ();
			pmw.Controls.Add (pv1);
			pmw.SetActiveView (pv1);
			Assert.AreEqual (pv1, pmw.GetActiveView (), "GetActiveView");
			Assert.AreEqual (1, pmw.Controls.Count, "MultiViewControlsCount");

		}
Example #31
0
		public void MultiView_AddParsedSubObjectExeption2 ()
		{
			PokerMultiView pmv = new PokerMultiView ();
			LiteralControl l1 = new LiteralControl ("literal");
			pmv.DoAddParsedSubObject (l1);
		}
Example #32
0
		public void MultiView_DefaultProperties ()
		{
			PokerMultiView pmw = new PokerMultiView ();
			Assert.AreEqual (0, pmw.StateBag.Count, "ViewState.Count");
			Assert.AreEqual (-1, pmw.ActiveViewIndex, "ActiveViewIndex");
			Assert.AreEqual (0, pmw.Views.Count, "DefaultZeroViews");
			Assert.AreEqual (PokerMultiView.NextViewCommandName, "NextView", "DefaultNextViewCommandName");
			Assert.AreEqual (PokerMultiView.PreviousViewCommandName, "PrevView", "DefaultPrevViewCommandName");
			Assert.AreEqual (PokerMultiView.SwitchViewByIDCommandName, "SwitchViewByID", "SwitchViewByIDCommandName");
			Assert.AreEqual (PokerMultiView.SwitchViewByIndexCommandName, "SwitchViewByIndex", "SwitchViewByIndexCommandName");
		}