Exemplo n.º 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));
        }
Exemplo n.º 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));
        }
Exemplo n.º 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));
        }
Exemplo n.º 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));
        }