コード例 #1
0
        public void CheckMoveShouldReturnOk(PieceType pieceType)
        {
            //Arrange
            var postionFrom       = new BoardPostion(1, 1);
            var postionTo         = new BoardPostion(3, 4);
            var factoryMock       = new Mock <IPieceStrategyFactory>();
            var pieceStrategyMock = new Mock <IPieceStrategy>();

            pieceStrategyMock
            .Setup(x => x.GetAvailableMovesAsync(postionFrom))
            .Returns(Task.FromResult <IEnumerable <BoardPostion> >(new [] { postionTo }));

            factoryMock
            .Setup(x => x.Create(It.IsAny <PieceType>()))
            .Returns(pieceStrategyMock.Object);

            var uut = new BoardService(factoryMock.Object);

            //Act
            var result = uut.CheckMove(pieceType, postionFrom, postionTo).Result;

            //Arrange
            Assert.That(result.Equals(MoveCheckStatus.Ok));
        }