예제 #1
0
        public void TestSetter_UserControlClass_UserControlNamespace_UserControlString()
        {
            // Changing of UserControl after realising a first UserControl specified through Constructor
            FPnl = new TPnlCollapsible(THostedControlKind.hckUserControl, HOSTEDUSERCONTROL);
            FPnl.RealiseUserControlNow();

            UserControl UC1 = FPnl.UserControlInstance;

            FPnl.UserControlClass = "TUC_Subscription";
            FPnl.UserControlNamespace = "Ict.Petra.Client.MPartner.Gui";
            FPnl.RealiseUserControlNow();

            Assert.AreNotEqual(UC1, FPnl.UserControlInstance);
            Assert.IsInstanceOf <Ict.Petra.Client.MPartner.Gui.TUC_Subscription>(FPnl.UserControlInstance);

            // Assigning of UserControl with UserControlClass and UserControlNamespace Properties
            FPnl = new TPnlCollapsible(new object[] { });
            FPnl.UserControlClass = "TUC_Subscription";
            FPnl.UserControlNamespace = "Ict.Petra.Client.MPartner.Gui";
            FPnl.RealiseUserControlNow();

            Assert.IsInstanceOf <Ict.Petra.Client.MPartner.Gui.TUC_Subscription>(FPnl.UserControlInstance);


            // Assigning of UserControl with UserControlString Property
            FPnl = new TPnlCollapsible(new object[] { });
            FPnl.UserControlString = "Ict.Petra.Client.MPartner.Gui.TUC_Subscription";

            // Calling Expand() has the side effect of instantiating the UserControl
            FPnl.Expand();

            UserControl UC2 = FPnl.UserControlInstance;
            Assert.IsInstanceOf <Ict.Petra.Client.MPartner.Gui.TUC_Subscription>(UC2);

            // Assures that a further call only makes a previously instantiated UserControl visible again
            FPnl.Expand();
            Assert.AreEqual(UC2, FPnl.UserControlInstance);
        }