public void FixMainGridCurrentRowIndexOnRefocus()
        {
            AddDataForSetList();
            CreateControllers(typeof(SetList));
            ParentGrid.Focus();
            Assert.AreEqual(1, View.SetMouseCursorToDefaultCount,
                            "SetMouseCursorToDefaultCount after focusing parent grid");
            Controller.Populate(); // Populate parent and main grids
            Assert.IsTrue(ParentGrid.Focused, "ParentGrid.Focused after Populate");
            Assert.AreEqual(2, View.SetMouseCursorToDefaultCount,
                            "SetMouseCursorToDefaultCount after Populate");
            MainGrid.Focus();
            Assert.AreEqual(3, View.SetMouseCursorToDefaultCount,
                            "SetMouseCursorToDefaultCount after focusing main grid");
            MainGridController.CreateAndGoToNewRow();
            int mainGridNewRowIndex = MainGrid.CurrentRowIndex;

            ParentGrid.Focus();
            // Simulate the problem that occurs when switching focus from the main grid to the
            // parent grid. If the main grid's current row is the new row before focusing the
            // parent grid, then, on focusing the parent grid, the new row is removed, so the
            // main grid's last existing row becomes its current row.
            MainGrid.MakeRowCurrent(mainGridNewRowIndex - 1);
            Assert.AreEqual(mainGridNewRowIndex - 1, MainGrid.CurrentRowIndex,
                            "Main grid current row index after focus switched back to parent grid");
            // Now test the fix. When focus is switched back to the main grid, we want to
            // restore currency to the new row.
            MainGrid.Focus();
            Assert.AreEqual(mainGridNewRowIndex, MainGrid.CurrentRowIndex,
                            "Main grid current row index after focus switched back to main grid");
            Assert.IsTrue(ParentGrid.Enabled,
                          "Parent grid enabled after focus switched back to main grid");
        }