/// <summary>
        /// Construcst the SelectorControlBinder with the Selector Control.
        /// </summary>
        /// <param name="listControl"></param>
        public HabaneroSelectorControlBinder(TControlType listControl)
        {
            _controlAdaptorFactory = new WinFormsControlAdaptorFactory();
            ControlBinders         = new List <HabaneroControlBinder <TBo> >();

            _lstControl      = _controlAdaptorFactory.GetHabaneroControl(listControl) as IListControl;
            _selectorManager = CreateBoColSelector(ListControl);
            _selectorManager.BusinessObjectSelected += OnBusinessObjectSelected;
        }
Example #2
0
 /// <summary>
 /// The Constructor
 /// </summary>
 /// <param name="parentSelector">The Parent Selector (in our example the "Countries").</param>
 /// <param name="childSelector">The Child Selector (in our example the "States").</param>
 /// <param name="relationshipName">The name of the relationship that is linking these two Business Objects and hence these two Selectors.
 ///   (in our example the "States" relationship on the Business Object "Country")</param>
 public BOColSelectorLinker(IBOColSelector parentSelector, IBOColSelector childSelector, string relationshipName)
 {
     if (parentSelector == null)
     {
         throw new ArgumentNullException("parentSelector");
     }
     if (childSelector == null)
     {
         throw new ArgumentNullException("childSelector");
     }
     if (string.IsNullOrEmpty(relationshipName))
     {
         throw new ArgumentNullException("relationshipName");
     }
     ParentSelector   = parentSelector;
     ChildSelector    = childSelector;
     RelationshipName = relationshipName;
     parentSelector.BusinessObjectSelected += this.ParentComboBoxBusinessObjectSelected;
     this.Enabled = true;
 }
        public void Test_Construct_WithNullChildSelector_ShouldRaiseError()
        {
            //---------------Set up test pack-------------------
            var            parentSelector   = CreateControl();
            IBOColSelector childSelector    = null;
            const string   relationshipName = "ChildLocations";

            //---------------Assert Precondition----------------
            Assert.IsNull(childSelector);
            //---------------Execute Test ----------------------
            try
            {
                new BOColSelectorLinker <FakeContactPerson, FakeAddress>(parentSelector, childSelector, relationshipName);
                Assert.Fail("expected ArgumentNullException");
            }
            //---------------Test Result -----------------------
            catch (ArgumentNullException ex)
            {
                StringAssert.Contains("Value cannot be null", ex.Message);
                StringAssert.Contains("childSelector", ex.ParamName);
            }
        }