private void GetFileWithLevel(string[] map, int n) { var gameFiles = new GamesFiles(); var dir = gameFiles.GetCurrentDirectory(); System.IO.File.AppendAllLines(dir + @"\Leveles\" + n.ToString() + ".txt", map); }
public void CanExtractWhenNoData() { var gameFiles = new GamesFiles(); var dir = gameFiles.GetCurrentDirectory(); var textMap = new string[0]; GetFileWithLevel(textMap, 5); var levelInf = new LevelFiles(dir, 5); var level = new LevelInformation(levelInf); Assert.IsEmpty(level.Platforms); System.IO.File.Delete(dir + @"\Leveles\5.txt"); }
public void CanNotExtractLevelWithIncorrectData() { var gameFiles = new GamesFiles(); var dir = gameFiles.GetCurrentDirectory(); var textMapWithWrongValue = new[] { "PLAT 0 0 5 5", "PLER 0 0", }; GetFileWithLevel(textMapWithWrongValue, 3); var levelInf = new LevelFiles(dir, 3); var level = new LevelInformation(levelInf); Assert.Throws <Exception>(() => level.Extractor.ExtractLevelFromFile()); System.IO.File.Delete(dir + @"\Leveles\3.txt"); }
public string GetDirectory() { var gameFiles = new GamesFiles(); return(gameFiles.GetCurrentDirectory()); }