Esempio n. 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());
        }
Esempio n. 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();
        }
Esempio n. 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);
        }
Esempio n. 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);
        }