public void WhenGetPositionAndStateWithCommandNull()
        {
            var mockCommand            = new Mock <ICommand>();
            var mockRobot              = new Mock <IRobot>();
            var mockCalculator         = new Mock <ICalculator>();
            var leftPositionCalculator = new LeftPositionCalculator(mockRobot.Object, mockCalculator.Object);

            Assert.Throws <ArgumentException>(() => leftPositionCalculator.GetPositionAndState(null));
        }
        public void WhenGetPositionAndStateWithCommandLeftFacingSouth()
        {
            var command   = new Left();
            var mockRobot = new Mock <IRobot>();

            mockRobot.SetupGet(r => r.CurrentPosition).Returns(new Position(new Location(1, 1), Direction.South));
            var mockCalculator         = new Mock <ICalculator>();
            var leftPositionCalculator = new LeftPositionCalculator(mockRobot.Object, mockCalculator.Object);
            var result = leftPositionCalculator.GetPositionAndState(command);

            Assert.Equal(Direction.East, result.position.Direction);
        }
        public void WhenProcessReportCommand()
        {
            var mockRobot = new Mock <IRobot>();

            mockRobot.Setup(r => r.GetReport());
            mockRobot.SetupGet(r => r.CurrentPosition).Returns(new Position(new Location(1, 1), Direction.West));
            var mockCalculator         = new Mock <ICalculator>();
            var leftPositionCalculator = new LeftPositionCalculator(mockRobot.Object, mockCalculator.Object);

            leftPositionCalculator.ProcessReportCommand();
            mockRobot.Verify(r => r.GetReport());
        }
        public void WhenGetPositionAndStateWithCommandNonLeft()
        {
            var command   = new Right();
            var mockRobot = new Mock <IRobot>();

            mockRobot.SetupGet(r => r.CurrentPosition).Returns(new Position(new Location(1, 1), Direction.West));
            var mockCalculator = new Mock <ICalculator>();

            mockCalculator.Setup(c => c.GetPositionAndState(It.IsAny <ICommand>()));
            var leftPositionCalculator = new LeftPositionCalculator(mockRobot.Object, mockCalculator.Object);
            var result = leftPositionCalculator.GetPositionAndState(command);

            mockCalculator.Verify(c => c.GetPositionAndState(It.IsAny <ICommand>()));
        }