Пример #1
0
        public void GetSequence_WillAddNewItemToList()
        {
            var moveManager = new MoveManager(new MoveGenerator());

            var sequence = moveManager.GetSequence();

            Assert.AreEqual(1, sequence.Count);
        }
Пример #2
0
        public void AddSequence_WillAddItemToList()
        {
            var moveManager = new MoveManager(new MoveGenerator());

            moveManager.AddMove(GameTile.BottomRight);

            Assert.AreEqual(1, moveManager.GameSequence.Count);
        }
Пример #3
0
        public void MakeMove_WhenMoveIsNotValid_WillReturnCorrectResult()
        {
            var moveManager = new MoveManager(new MoveGenerator());

            moveManager.AddMove(GameTile.BottomRight);
            moveManager.AddMove(GameTile.BottomRight);
            moveManager.AddMove(GameTile.BottomLeft);

            var expectedResult = AttemptResult.InValid;
            var result = moveManager.MakeMove(GameTile.BottomLeft);

            Assert.AreEqual(expectedResult, result);
        }
Пример #4
0
        public void LastMoveIndex_WhenMoveMade_WhenValid_WillIncrementIndex()
        {
            var moveManager = new MoveManager(new MoveGenerator());

            var originalIndex = moveManager.LastMoveIndex;

            moveManager.AddMove(GameTile.TopLeft);

            moveManager.MakeMove(GameTile.TopLeft);

            var updatedIndex = moveManager.LastMoveIndex;

            Assert.AreNotEqual(originalIndex, updatedIndex);
        }
Пример #5
0
        public void GetSequence_WhenCalledMultipleTimes_WillAddNewItemsToList()
        {
            var moveManager = new MoveManager(new MoveGenerator());

            var sequence1 = moveManager.GetSequence();
            Assert.AreEqual(1, sequence1.Count);

            var sequence2 = moveManager.GetSequence();
            Assert.AreEqual(2, sequence2.Count);

            var sequence3 = moveManager.GetSequence();
            Assert.AreEqual(3, sequence3.Count);

            var sequence4 = moveManager.GetSequence();
            Assert.AreEqual(4, sequence4.Count);
        }
Пример #6
0
        public void MakeMove_WhenMultipleMoves_WillAllBeValud()
        {
            var moveManager = new MoveManager(new MoveGenerator());

            moveManager.AddMove(GameTile.BottomRight);
            moveManager.AddMove(GameTile.BottomRight);
            moveManager.AddMove(GameTile.BottomLeft);

            var result1 = moveManager.MakeMove(GameTile.BottomRight);
            var result2 = moveManager.MakeMove(GameTile.BottomRight);
            var result3 = moveManager.MakeMove(GameTile.BottomLeft);

            Assert.AreEqual(AttemptResult.Valid, result1);
            Assert.AreEqual(AttemptResult.Valid, result2);
            Assert.AreEqual(AttemptResult.Valid, result3);
        }