public void Test_DeleteButtonWithNothingSelected_DoesNothing()
 {
     //---------------Set up test pack-------------------
     BusinessObjectCollection<MyBO> col;
     IReadOnlyGridControl grid = GetGridWith_4_Rows(out col, true);
     grid.Buttons.ShowDefaultDeleteButton = true;
     grid.ConfirmDeletion = true;
     grid.SelectedBusinessObject = null;
     ObjectDeletorStub objectDeletor = new ObjectDeletorStub();
     grid.BusinessObjectDeletor = objectDeletor;
     //---------------Assert Precondition----------------
     Assert.IsNull(grid.SelectedBusinessObject   );
     //---------------Execute Test ----------------------
     grid.Buttons["Delete"].PerformClick();
     //---------------Test Result -----------------------
     Assert.IsFalse(objectDeletor.HasBeenCalled);
 }
        public virtual void Test_DeleteButton_CallsObjectDeletor()
        {
            //---------------Set up test pack-------------------
            BusinessObjectCollection<MyBO> col;
            IReadOnlyGridControl grid = GetGridWith_4_Rows(out col, true);
            grid.Buttons.ShowDefaultDeleteButton = true;
            grid.ConfirmDeletion = true;
            grid.SelectedBusinessObject = col[2];

            grid.CheckUserConfirmsDeletionDelegate -= grid.Grid.CheckUserWantsToDelete;
            grid.CheckUserConfirmsDeletionDelegate += () => true;
            ObjectDeletorStub objectDeletor = new ObjectDeletorStub();
            grid.BusinessObjectDeletor = objectDeletor;
            //---------------Execute Test ----------------------
            grid.Buttons["Delete"].PerformClick();
            //---------------Test Result -----------------------
            Assert.IsTrue(objectDeletor.HasBeenCalled);
            Assert.AreSame(col[2], objectDeletor.Bo);   
        }