public void Of_BuildPgn_Succeeds(string pgnFile) { // Arrange string lines = ResourceHelper.ReadEmbeddedRessource(pgnFile); // Act Option <Pgn> expected = Pgn.Import(lines); // Assert expected.Match( None: () => Assert.Fail(), Some: p => Assert.IsTrue(true)); }
private void BtnLoadPgn_Click(object sender, EventArgs e) { this.openFileDialog1 = new OpenFileDialog(); this.openFileDialog1.Filter = "pgn files (*.pgn)|*.pgn|All files (*.*)|*.*"; this.openFileDialog1.FilterIndex = 0; this.openFileDialog1.Title = "Browse Portable Game Notation files"; var result = this.openFileDialog1.ShowDialog(); if (DialogResult.OK.Equals(result)) { string pgnString = string.Empty; Using(new StreamReader(this.openFileDialog1.FileName), reader => pgnString = reader.ReadToEnd()); this.boardController.SetFromPgn(Pgn.Import(pgnString)); } }