Example #1
0
        public void Test_SetSelectedBusinessObject_SetsSelectedBO()
        {
            //---------------Set up test pack-------------------
            IHabaneroSelectorControlBinder <FakeBo> selectorBinder = CreateHabaneroSelectorControlBinder();
            var businessObjectCollection = GetBusinessObjectCollectionWith3Items();
            var boToSelect = businessObjectCollection[2];

            selectorBinder.SetBusinessObjectCollection(businessObjectCollection);
            //---------------Assert Precondition----------------
            Assert.IsNotNull(boToSelect);
            Assert.AreNotSame(boToSelect, selectorBinder.SelectedBusinessObject);
            //---------------Execute Test ----------------------
            selectorBinder.SelectedBusinessObject = boToSelect;
            //---------------Test Result -----------------------
            Assert.AreSame(boToSelect, selectorBinder.SelectedBusinessObject);
        }
Example #2
0
        public void Test_BindHabaneroControlBinder_ThenSelectItemViaControl_ShouldSetBusinessObjectControlBinder()
        {
            //---------------Set up test pack-------------------
            IHabaneroSelectorControlBinder <FakeBo> selectorBinder = CreateHabaneroSelectorControlBinder();
            var businessObjectCollection = GetBusinessObjectCollectionWith3Items();

            selectorBinder.SetBusinessObjectCollection(businessObjectCollection);
            var boToSelect = businessObjectCollection[2];

            var controlBinder = new HabaneroControlBinder <FakeBo>();

            //---------------Assert Precondition----------------
            Assert.IsNull(controlBinder.BusinessObject);
            Assert.IsNotNull(boToSelect);
            //---------------Execute Test ----------------------
            selectorBinder.BindEditorControlBinder(controlBinder);
            selectorBinder.ListControl.SelectedItem = boToSelect;
            //---------------Test Result -----------------------
            Assert.AreSame(boToSelect, controlBinder.BusinessObject);
        }