private IBOColTabControl CreateBOTabControlWithControlCreator(out BusinessObjectControlCreatorDelegate creator)
        {
            IBOColTabControl boColTabControl = GetControlFactory().CreateBOColTabControl();

            creator = GetBusinessObjectControlStub;
            boColTabControl.BusinessObjectControlCreator = creator;
            return(boColTabControl);
        }
Example #2
0
        protected virtual BOColTabControlManager GetselectorManager(out BusinessObjectControlCreatorDelegate creator)
        {
            IControlFactory        controlFactory  = GetControlFactory();
            ITabControl            tabControl      = controlFactory.CreateTabControl();
            BOColTabControlManager selectorManager = new BOColTabControlManager(tabControl, controlFactory);

            creator = BusinessObjectControlCreator;
            selectorManager.BusinessObjectControlCreator = creator;
            return(selectorManager);
        }
        public void Test_SetUpBOTabColManagerWithDelegateForCreating_aBOControl()
        {
            //---------------Set up test pack-------------------
            IBOColTabControl boColTabControl             = GetControlFactory().CreateBOColTabControl();
            BusinessObjectControlCreatorDelegate creator = GetBusinessObjectControlStub;

            //---------------Assert Precondition----------------
            Assert.IsNull(boColTabControl.BusinessObjectControlCreator);
            //---------------Execute Test ----------------------
            boColTabControl.BusinessObjectControlCreator = creator;
            //---------------Test Result -----------------------
            Assert.IsNotNull(boColTabControl.BusinessObjectControlCreator);
            Assert.AreEqual(creator, boColTabControl.BusinessObjectControlCreator);
        }
Example #4
0
        public void Test_WhenUsingCreator_SetUpBOTabColManagerWithDelegateForCreating_aBOControl()
        {
            //---------------Set up test pack-------------------
            ITabControl            tabControl            = CreateTabControl();
            IControlFactory        controlFactory        = GetControlFactory();
            BOColTabControlManager selectorManager       = new BOColTabControlManager(tabControl, controlFactory);
            BusinessObjectControlCreatorDelegate creator = BusinessObjectControlCreator;

            //---------------Assert Precondition----------------
            Assert.IsNull(selectorManager.BusinessObjectControlCreator);
            //---------------Execute Test ----------------------
            selectorManager.BusinessObjectControlCreator = creator;
            //---------------Test Result -----------------------
            Assert.IsNotNull(selectorManager.BusinessObjectControlCreator);
            Assert.AreEqual(creator, selectorManager.BusinessObjectControlCreator);
        }
Example #5
0
        public void Test_WhenUsingCreator_WhenBusinessObejctRemovedToCollection_ShouldRemoveTab()
        {
            ITabControl            tabControl            = CreateTabControl();
            IControlFactory        controlFactory        = GetControlFactory();
            BOColTabControlManager selectorManager       = new BOColTabControlManager(tabControl, controlFactory);
            BusinessObjectControlCreatorDelegate creator = BusinessObjectControlCreator;

            selectorManager.BusinessObjectControlCreator = creator;

            MyBO removedBo = new MyBO();
            BusinessObjectCollection <MyBO> myBoCol = new BusinessObjectCollection <MyBO> {
                removedBo, new MyBO(), new MyBO()
            };

            selectorManager.BusinessObjectCollection = myBoCol;
            bool             pageRemovedEventFired = false;
            TabPageEventArgs ex = null;

            selectorManager.TabPageRemoved += (sender, e) =>
            {
                pageRemovedEventFired = true;
                ex = e;
            };
            ITabPage         tabPage = selectorManager.TabControl.TabPages[0];
            IControlHabanero boControlToBeRemoved = tabPage.Controls[0];

            //---------------Assert Precondition----------------
            Assert.AreEqual(3, selectorManager.TabControl.TabPages.Count);
            Assert.IsFalse(pageRemovedEventFired);
            //---------------Execute Test ----------------------
            selectorManager.BusinessObjectCollection.Remove(removedBo);
            //---------------Test Result -----------------------
            Assert.AreEqual(2, selectorManager.TabControl.TabPages.Count);

            Assert.AreEqual(removedBo.ToString(), tabPage.Text);
            Assert.AreEqual(removedBo.ToString(), tabPage.Name);
            Assert.AreEqual(1, tabPage.Controls.Count);

            Assert.IsTrue(pageRemovedEventFired);
            Assert.IsNotNull(ex);
            Assert.AreSame(tabPage, ex.TabPage);
            Assert.AreSame(boControlToBeRemoved, ex.BOControl);
        }
 protected virtual BOColTabControlManager GetselectorManager(out BusinessObjectControlCreatorDelegate creator)
 {
     IControlFactory controlFactory = GetControlFactory();
     ITabControl tabControl = controlFactory.CreateTabControl();
     BOColTabControlManager selectorManager = new BOColTabControlManager(tabControl, controlFactory);
     creator = BusinessObjectControlCreator;
     selectorManager.BusinessObjectControlCreator = creator;
     return selectorManager;
 }
 private IBOColTabControl CreateBOTabControlWithControlCreator(out BusinessObjectControlCreatorDelegate creator)
 {
     IBOColTabControl boColTabControl = GetControlFactory().CreateBOColTabControl();
     creator = GetBusinessObjectControlStub;
     boColTabControl.BusinessObjectControlCreator = creator;
     return boColTabControl;
 }