public void Move_IfCommandEmpty_NotCallSingleInvoker()
        {
            var instance = new MultipleCommandInvoker(SingleCommandInvoker.Object);

            instance.Move(string.Empty, null);
            SingleCommandInvoker.Verify(x => x.Move(It.IsAny <string>(), null), Times.Never);
        }
Ejemplo n.º 2
0
        public RunnerFacade()
        {
            //It is possible with DI
            var rotateLeftActionInvoker = new ActionDeciderByPositionActionInvoker(
                new RotateLeftNActionInvoker(),
                new RotateLeftSActionInvoker(),
                new RotateLeftWActionInvoker(),
                new RotateLeftEActionInvoker()
                );

            var rotaeRightActionInvoker = new ActionDeciderByPositionActionInvoker(
                new RotateRightNActionInvoker(),
                new RotateRightSActionInvoker(),
                new RotateRightWActionInvoker(),
                new RotateRightEActionInvoker()
                );

            var moveActionInvoker = new ActionDeciderByPositionActionInvoker(
                new MoveNActionInvoker(),
                new MoveSActionInvoker(),
                new MoveWActionInvoker(),
                new MoveEActionInvoker()
                );

            var singleCommandInvoker = new SingleCommandInvoker(moveActionInvoker, rotateLeftActionInvoker, rotaeRightActionInvoker);

            commandInvoker = new MultipleCommandInvoker(singleCommandInvoker);
        }
        public void Move_CallMove_CallSingleInvokerSameCount()
        {
            string command  = "TESTCOMMAND";
            var    instance = new MultipleCommandInvoker(SingleCommandInvoker.Object);

            instance.Move(command, null);
            SingleCommandInvoker.Verify(x => x.Move(It.IsAny <string>(), null), Times.AtLeast(command.Length));
            SingleCommandInvoker.Verify(x => x.Move(It.IsAny <string>(), null), Times.AtMost(command.Length));
        }
        public void Move_IfCommandNull_ThrowsException()
        {
            var instance = new MultipleCommandInvoker(SingleCommandInvoker.Object);

            Assert.ThrowsException <NullReferenceException>(() => instance.Move(null, null));
        }