コード例 #1
0
        public void DirectoryExecuteSearchUnsuccessful()
        {
            // given
            var appDataPathExtended = SetUp(TestContext.CurrentContext.Test.Name);

            // when
            var res = DirectorySearchHelper.DirectoryExecuteSearch(Path.Combine(appDataPathExtended, "Test3"));

            // then
            Assert.IsFalse(res);
        }
コード例 #2
0
        public void DirectoryExecuteSearchSuccessful()
        {
            // given
            var appDataPathExtended = SetUp(TestContext.CurrentContext.Test.Name);

            // when
            var res = DirectorySearchHelper.DirectoryExecuteSearch(appDataPathExtended);

            // then
            Assert.IsTrue(res);
        }
コード例 #3
0
        public void FindNewGamesWithoutNewGames()
        {
            // given
            var appDataPathExtended = SetUp(TestContext.CurrentContext.Test.Name);
            var gameDirectory       = new GameDirectory(appDataPathExtended);

            // when
            var newGames = DirectorySearchHelper.FindNewGames(gameDirectory);

            // then
            CollectionAssert.IsEmpty(newGames);
        }
コード例 #4
0
        public void GetAllGamesFromPath()
        {
            // given
            var appDataPathExtended = SetUp(TestContext.CurrentContext.Test.Name);

            // when
            var games = DirectorySearchHelper.GetAllGamesFromPath(appDataPathExtended);

            // then
            CollectionAssert.IsNotEmpty(games);
            Assert.AreEqual(games.Count, 2);
            CollectionAssert.Contains(games, new Game(Path.Combine(appDataPathExtended, "Test1")));
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        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]);
        }
コード例 #7
0
        public void FindNewGamesSuccessful()
        {
            // given
            var appDataPathExtended = SetUp(TestContext.CurrentContext.Test.Name);
            var gameDirectory       = new GameDirectory(appDataPathExtended);

            Directory.CreateDirectory(Path.Combine(appDataPathExtended, "Test3", "Test31"));
            using FileStream fs1 = File.Create(Path.Combine(appDataPathExtended, "Test3", "Test31", "test3.exe"));

            // when
            var newGames = DirectorySearchHelper.FindNewGames(gameDirectory);

            // then
            CollectionAssert.IsNotEmpty(newGames);
            CollectionAssert.Contains(newGames, new Game(Path.Combine(appDataPathExtended, "Test3")));
            Assert.AreEqual(newGames.Count, 1);
        }
コード例 #8
0
 public GameDirectory(string path) : this()
 {
     _directory = path;
     _games     = DirectorySearchHelper.FindNewGames(this);
 }