public static List <Game> FindNotExistingGames(GameDirectory gameDirectory) { List <Game> notExistingGameList = new List <Game>(); foreach (Game g in gameDirectory.GetGames()) { if (!Directory.Exists(g.DirectoryPath)) { notExistingGameList.Add(g); } } return(notExistingGameList); }
public static List <Game> FindNewGames(GameDirectory gameDirectory) { List <Game> gameList = new List <Game>(); foreach (Game g in GetAllGamesFromPath(gameDirectory.Directory)) { if (!gameDirectory.GetGames().Contains(g)) { gameList.Add(g); } } return(gameList); }
public void FindNotExistingGamesWithNoMissingGame() { // given var appDataPathExtended = SetUp(TestContext.CurrentContext.Test.Name); // when var gameDirectory = new GameDirectory(appDataPathExtended); var games = DirectorySearchHelper.FindNotExistingGames(gameDirectory); // then Assert.AreEqual(0, games.Count); Assert.AreEqual(2, gameDirectory.GetGames().Count); }
public void FindNotExistingGamesSuccessful() { // given var appDataPathExtended = SetUp(TestContext.CurrentContext.Test.Name); // when var gameDirectory = new GameDirectory(appDataPathExtended); Directory.Delete(Path.Combine(appDataPathExtended, "Test1"), true); var games = DirectorySearchHelper.FindNotExistingGames(gameDirectory); // then Assert.AreEqual(1, games.Count); Assert.AreEqual(2, gameDirectory.GetGames().Count); Assert.AreEqual(new Game(Path.Combine(appDataPathExtended, "Test1")), games[0]); }