Пример #1
0
        public void ApplyHigherPriorityBehavior_IfTheyAllApplicable()
        {
            var getNewCardBehaviour  = new GetNewCardBahaviour();
            var moveOwnCardBehaviour = new MoveOwnCardForwardBehaviour();
            var behaviours           = new List <PlayerBehaviourContainer>
            {
                new PlayerBehaviourContainer(priority: 1, behaviour: getNewCardBehaviour),
                new PlayerBehaviourContainer(priority: 2, behaviour: moveOwnCardBehaviour),
            };
            var playerBehaviour = Create.PlayerBehavoiur
                                  .WithTailsBehaviours(behaviours)
                                  .Build();

            var boardMap = $@"  +-------------------------------+
                                +InProgress|InTesting |Completed+
                                +-------------------------------+
                                +Ivan      |          |         +
                                +          |          |         +
                                +-------------------------------+";
            var board    = Create.Board.FromMap(boardMap);

            var newBoard = playerBehaviour.Apply("Ivan", board, CoinSide.Tails);

            Assert.True(getNewCardBehaviour.CanApply("Ivan", board, CoinSide.Tails));
            Assert.True(moveOwnCardBehaviour.CanApply("Ivan", board, CoinSide.Tails));
            AssertBoard.Equals($@"+-------------------------------+
                                  +InProgress|InTesting |Completed+
                                  +-------------------------------+
                                  +Ivan      |          |         +
                                  +Ivan      |          |         +
                                  +-------------------------------+", newBoard);
        }
Пример #2
0
        public void AllowGetNewCard_IfWipLimitNotExceed()
        {
            var getNewCardBehaviour = new GetNewCardBahaviour();
            var boardMap            = $@"  +-------------------------------+
                                +InProgress|InTesting |Completed+
                                +-------------------------------+
                                +Ivan      |          |         +
                                +          |          |         +
                                #-------------------------------#
                                +Limit:2   |Limit:2   |         +";
            var board = Create.Board.FromMap(boardMap);

            Assert.True(getNewCardBehaviour.CanApply("Ivan", board, CoinSide.Tails));
        }
Пример #3
0
        public void CanGetAdditionalCard_OnApply()
        {
            var getNewCardBehaviour = new GetNewCardBahaviour();
            var boardMap            = $@"  +-------------------------------+
                                +InProgress|InTesting |Completed+
                                +-------------------------------+
                                +Ivan      |          |         +
                                +          |          |         +
                                +-------------------------------+";
            var board    = Create.Board.FromMap(boardMap);
            var newBoard = getNewCardBehaviour.Apply("Ivan", board, CoinSide.Eagle);

            Assert.True(getNewCardBehaviour.CanApply("Ivan", board, CoinSide.Eagle));
            AssertBoard.Equals($@"+-------------------------------+
                                  +InProgress|InTesting |Completed+
                                  +-------------------------------+
                                  +Ivan      |          |         +
                                  +Ivan      |          |         +
                                  +-------------------------------+", newBoard);
        }