コード例 #1
0
        public void LoadGameTest()
        {
            model.NewGame(29);
            model.SaveGame(@"..\..\..\..\TestFiles\test29by29.txt");

            Assert.AreEqual(true, model.LoadGame(@"..\..\..\..\TestFiles\test29by29.txt"));
            Assert.AreEqual(29, model.TableSize);
            Assert.AreEqual(0, model.P1InTheHole);
            Assert.AreEqual(0, model.P2InTheHole);
            Assert.AreEqual(true, model.FirstsTurn);
        }
コード例 #2
0
        private void LoadGame(object sender, EventArgs e)
        {
            OpenFileDialog openDialog = new OpenFileDialog();

            openDialog.Filter           = "txt files (*.txt)|*.txt";
            openDialog.InitialDirectory = @".\Saves";
            openDialog.RestoreDirectory = true;
            if (openDialog.ShowDialog() == DialogResult.OK)
            {
                model.LoadGame(openDialog.FileName);
            }
        }