예제 #1
0
        public void ShouldBeInLimitCo_OrdinatesFromInput()
        {
            var rover = TestableRover.Create();

            IPosition position = new RoverPosition(10, 10);
            rover.PrompterMock.Setup(x => x.IsValid()).Returns(true);
            _firstRover = new Rover(position, rover.PrompterMock.Object, DirectionType.N);
            Assert.IsFalse(_firstRover.IsValid());
        }
예제 #2
0
        public void ShouldBeInLimitCo_OrdinatesFromOutput()
        {
            var rover = TestableRover.Create();

            IPosition position = new RoverPosition(1, 2);
            rover.PrompterMock.SetupProperty(x => x.Command, "MMMMMMMMMMMMMM");
            rover.PrompterMock.Setup(x => x.IsValid()).Returns(true);
            _firstRover = new Rover(position, rover.PrompterMock.Object, DirectionType.N);
            _firstRover.Execute();
        }
예제 #3
0
        public void ShouldBeSecondRoverValidOutput()
        {
            var rover = TestableRover.Create();

            IPosition position = new RoverPosition(3, 3);
            rover.PrompterMock.SetupProperty(x => x.Command, "MMRMMRMRRM");
            rover.PrompterMock.Setup(x => x.IsValid()).Returns(true);
            _secondRover = new Rover(position, rover.PrompterMock.Object, DirectionType.E);
            var result = _secondRover.Execute();

            Assert.AreEqual("5 1 E", result);
        }
예제 #4
0
        public void ShouldBeFirstRoverValidOutput()
        {
            var rover = TestableRover.Create();

            IPosition position = new RoverPosition(1, 2);
            rover.PrompterMock.SetupProperty(x => x.Command, "LMLMLMLMM");
            rover.PrompterMock.Setup(x => x.IsValid()).Returns(true);
            _firstRover = new Rover(position, rover.PrompterMock.Object, DirectionType.N);
            var result = _firstRover.Execute();

            Assert.AreEqual("1 3 N", result);
        }