コード例 #1
0
        public void GetNextMovementReturnsAPlayingMessageIfGameContinues()
        {
            WordTreeManager      manager  = new WordTreeManager(_providerMock, _configurationMock);
            GhostGameResponseDto response = manager.GetNextMovement("t");

            Assert.IsNotNull(response);
            Assert.AreEqual(GameStatus.Playing, response.GameStatus);
            Assert.IsFalse(string.IsNullOrEmpty(response.Message));
            Assert.IsFalse(string.IsNullOrEmpty(response.CurrentWord));
        }
コード例 #2
0
        public void GetNextMovementReturnsAHumanWonMessageIfTheOnlyOptionLeftIsEndingAWord()
        {
            WordTreeManager      manager  = new WordTreeManager(_providerMock, _configurationMock);
            GhostGameResponseDto response = manager.GetNextMovement("w");

            Assert.IsNotNull(response);
            Assert.AreEqual(GameStatus.HumanPlayerWon, response.GameStatus);
            Assert.IsFalse(string.IsNullOrEmpty(response.Message));
            Assert.IsFalse(string.IsNullOrEmpty(response.CurrentWord));
        }
コード例 #3
0
        public void GetNextMovementReturnsAComputerWonResponseIfWordDoesNotExist()
        {
            WordTreeManager      manager  = new WordTreeManager(_providerMock, _configurationMock);
            GhostGameResponseDto response = manager.GetNextMovement("x");

            Assert.IsNotNull(response);
            Assert.AreEqual(GameStatus.ComputerWon, response.GameStatus);
            Assert.IsFalse(string.IsNullOrEmpty(response.Message));
            Assert.IsFalse(string.IsNullOrEmpty(response.CurrentWord));
        }
コード例 #4
0
        public void GetNextMovementReturnsAComputerWonResponseIfWordCompletesATreeBranch()
        {
            WordTreeManager manager = new WordTreeManager(_providerMock, _configurationMock);

            manager.LastSelectedNode = manager.GetCurrentNode("g");
            GhostGameResponseDto response = manager.GetNextMovement("go");

            Assert.IsNotNull(response);
            Assert.AreEqual(GameStatus.ComputerWon, response.GameStatus);
            Assert.IsFalse(string.IsNullOrEmpty(response.Message));
            Assert.IsFalse(string.IsNullOrEmpty(response.CurrentWord));
        }