public void ParseTaskTest() { var taskLoader = new CrossWordTaskLoader(); CrossWordTask task; Assert.IsTrue(taskLoader.TryLoadFromFile(CROSSWORD_10_X_10_TASK_PATH, out task)); Assert.AreEqual(task.ColumnsTasks.Length, 10); Assert.AreEqual(task.RowsTasks.Length, 10); }
private CrossWordTask ParseTask(string file) { var extension = Path.GetExtension(file); var taskLoader = new CrossWordTaskLoader(); CrossWordTask task; if (extension.Equals(".bmp", StringComparison.OrdinalIgnoreCase) || extension.Equals(".png", StringComparison.OrdinalIgnoreCase)) { Bitmap bmp = (Bitmap)Bitmap.FromFile(file); task = CrossWordTaskLoader.ParseFromBitmap(bmp); } else { taskLoader.TryLoadFromFile(file, out task); } return(task); }