Example #1
0
        public void CompareBoards_OneBoardIsNull_ReturnsFalse()
        {
            //arrange
            Frame[,] differentBoard = null;
            //act

            //assert
            Assert.IsFalse(BoardComparer.AreBoardsEqual(_testBoard, differentBoard));
        }
Example #2
0
        //every parameter value for map size except [3;9] should throw InvalidMapSizeException
        public void CompareBoards_IdenticalBoards_ReturnsTrue()
        {
            //arrange

            //act

            //assert
            Assert.IsTrue(BoardComparer.AreBoardsEqual(_testBoard, _testBoard));
        }
        public void MoveFrameOnNewPlayfield_UpAndLeft_BoardChanges(Direction direction)
        {
            // arrange

            // act
            bool testResult = Manipulator.GetInstance().MakeMove(_playfieldStub.Object, direction, false);

            // assert
            Assert.IsFalse(BoardComparer.AreBoardsEqual(_testBoard, _testBoardBeforeMoveAttempt));
            //Assert.AreNotEqual(_testBoard, _testBoardBeforeMoveAttempt);
        }
        public void BoardCreation_ValidSettings_ReturnValueMatchesExpectedValue(int boardSize, Frame[,] expectedResult)
        {
            // arrange
            FrameCreator frameCreator = new TextFrameCreator();

            // act
            Frame[,] testResult = frameCreator.CreateBoard(boardSize);

            // assert
            Assert.IsTrue(BoardComparer.AreBoardsEqual(testResult, expectedResult));
        }
        public void MoveFrameOnPlayfield_InDirection_MatchesExpectedResult(Direction direction, Frame[,] startBoard, Frame[,] expectedBoard)
        {
            // arrange
            _playfieldStub.SetupGet(x => x.Board).Returns(startBoard);

            // act
            bool testResult = Manipulator.GetInstance().MakeMove(_playfieldStub.Object, direction, false);

            // assert
            Assert.IsTrue(BoardComparer.AreBoardsEqual(startBoard, expectedBoard));
            //Assert.AreEqual(startBoard, expectedBoard);
        }
        public void MoveFrameOutOfNewPlayfield_RightAndDown_BoardUnchanged(Direction direction)
        {
            // arrange
            Manipulator testManipulator = Manipulator.GetInstance();

            // act
            bool testResult = testManipulator.MakeMove(_playfieldStub.Object, direction, false);

            // assert
            Assert.IsTrue(BoardComparer.AreBoardsEqual(_testBoard, _playfieldStub.Object.Board));
            //Assert.AreEqual(_testBoard, _playfieldStub.Object.Board);
        }
Example #7
0
        public void CompareBoards_DifferentBoards_ReturnsFalse()
        {
            //arrange
            Frame[,] differentBoard = new Frame[3, 3]
            {
                { null, null, null },
                { new TextFrame("4", new Point(0, 1)), new TextFrame("5", new Point(1, 1)), new TextFrame("6", new Point(2, 1)) },
                { new TextFrame("7", new Point(0, 2)), new TextFrame("8", new Point(1, 2)), null }
            };;
            //act

            //assert
            Assert.IsFalse(BoardComparer.AreBoardsEqual(_testBoard, differentBoard));
        }