public void EmptyFile() { var parser = new PgnReader(); var db = parser.ReadFromFile(TestFolder + "empty-file.pgn"); Assert.Empty(db.Games); }
public void EmptyFile() { var parser = new PgnReader(); var db = parser.ReadFromFile(TestFolder + "empty-file.pgn"); Assert.AreEqual(0, db.Games.Count); }
static void Main(string[] args) { var reader = new PgnReader(); var db = reader.ReadFromFile("Tarrasch.pgn"); var game = db.Games[0]; Console.WriteLine("{0} vs {1} in {2} ({3})", game.WhitePlayer, game.BlackPlayer, game.Site, game.Year); if (game.Result == GameResult.White) { Console.WriteLine("\nWhite wins in {0} moves.", game.MoveText.FullMoveCount); } else if (game.Result == GameResult.Black) { Console.WriteLine("\nBlack wins in {0} moves.", game.MoveText.FullMoveCount); } else if (game.Result == GameResult.Draw) { Console.WriteLine("\nGame ends in a draw."); } else { Console.WriteLine("\nGame not unfinshed."); } Console.WriteLine(); Console.WriteLine("Press any key to exit."); Console.ReadKey(); }
public void ReadFromFile_should_return_a_Database() { var parser = new PgnReader(); PrepareFile("test.pgn", NormalGame); Assert.IsInstanceOfType(parser.ReadFromFile("test.pgn"), typeof(Database)); }
public void ReadFromFile_should_return_a_Database() { var parser = new PgnReader(); PrepareFile("test.pgn", NormalGame); Assert.IsType <Database>(parser.ReadFromFile("test.pgn")); }
public void ReadFromFile_should_return_read_game_from_file() { var parser = new PgnReader(); PrepareFile("one-game.pgn", NormalGame); var db = parser.ReadFromFile("one-game.pgn"); Assert.AreEqual(1, db.Games.Count); }
public static Database TestFile(string fileName) { if (!System.IO.File.Exists(TestFolder + fileName)) Assert.Inconclusive("Test data not available (" + TestFolder + fileName + ")"); var parser = new PgnReader(); return parser.ReadFromFile(TestFolder + fileName); }
public void Convert(IConversionStrategy strategy, string pgnFilename) { var pgnFileReader = new PgnReader(); Database gameDb = pgnFileReader.ReadFromFile(pgnFilename); foreach (var game in gameDb.Games) { strategy.ConvertAllFens(game); } }
public static Database TestFile(string fileName) { if (!System.IO.File.Exists(TestFolder + fileName)) { throw new XunitException("Test data not available (" + TestFolder + fileName + ")"); } var parser = new PgnReader(); return(parser.ReadFromFile(TestFolder + fileName)); }
public List <Match> LoadFromFile(string filePath) { var reader = new PgnReader(); var database = reader.ReadFromFile(filePath); return(database .Games .Select(a => ToMatch(a)) .ToList()); }
public static Database TestFile(string fileName) { if (!System.IO.File.Exists(TestFolder + fileName)) { Assert.Inconclusive("Test data not available (" + TestFolder + fileName + ")"); } var parser = new PgnReader(); return(parser.ReadFromFile(TestFolder + fileName)); }
public void ReadFromFile_should_throw_Exception_if_file_is_not_found() { var parser = new PgnReader(); Assert.IsInstanceOfType(parser.ReadFromFile("blub_non-existent.pgn"), typeof(Database)); }
static Database ReadPgn(string fileName) { var reader = new PgnReader(); return(reader.ReadFromFile(fileName)); }