Пример #1
0
        public void Test_GetBusinessObjectAtRow_WhenSetViaCustomLoad_ShouldRetBO()
        {
            //---------------Set up test pack-------------------
            MyBO.LoadDefaultClassDef();
            BusinessObjectCollection <MyBO> col = CreateCollectionWith_4_Objects();
            IReadOnlyGrid readOnlyGrid          = GetControlFactory().CreateReadOnlyGrid();

            DisposeOnTearDown(readOnlyGrid);
            AddControlToForm(readOnlyGrid);
            SetupGridColumnsForMyBo(readOnlyGrid);
            readOnlyGrid.BusinessObjectCollection = col;
            //---------------Assert Precondition----------------
            Assert.AreEqual(4, readOnlyGrid.Rows.Count);
            //---------------Execute Test ----------------------
            var actualBO = readOnlyGrid.GetBusinessObjectAtRow(1);

            //---------------Test Result -----------------------
            Assert.AreSame(col[1], actualBO);
        }
Пример #2
0
        protected override void SetSelectedIndex(IBOColSelectorControl colSelector, int index)
        {
            int count = 0;

            IReadOnlyGrid readOnlyGrid = ((IReadOnlyGridControl)colSelector).Grid;

            foreach (IDataGridViewRow row in readOnlyGrid.Rows)
            {
                if (row == null)
                {
                    continue;             //This is done to stop the Pragma warning.
                }
                if (count == index)
                {
                    IBusinessObject businessObjectAtRow = readOnlyGrid.GetBusinessObjectAtRow(count);
                    colSelector.SelectedBusinessObject = businessObjectAtRow;
                }
                count++;
            }
        }