private void MyEventHandler(object sender, EventArgs e) { if (sender == bt1) { game = BattleShipGame.getInstance(); if (game != battleship) { battleship = (BattleShipGame)game; form = new Form_Battleship(); } } else if (sender == bt2) { game = KangarooGame.getInstance(); if (game != kangaroo) { kangaroo = (KangarooGame)game; form = new Form_Kangaroo(); } } else if (sender == bt3) { game = MatchesGame.getInstance(); if (game != matches) { matches = (MatchesGame)game; form = new Form_Matches(); } } // if (!form.IsDisposed && form != null) { form.Show(); } else { if (battleship != null) { battleship.setToNull(); } if (kangaroo != null) { kangaroo.setToNull(); } if (matches != null) { matches.setToNull(); } } }
public void TestMethod1() { // Here I'll test the Background functionality of the BattleShipGame unit // For another games also will be created other unit test classes with its // series of unit test methods... game = BattleShipGame.getInstance(); if (game != battleship) { battleship = (BattleShipGame)game; } battleship.setToNull(); }