예제 #1
0
        public void ShouldFollowWaypointInstructionsAndCalculateManhattanDistance()
        {
            // Arrange
            var instructions = new List <string>
            {
                "F10",
                "N3",
                "F7",
                "R90",
                "F11"
            };

            var navigationSystem = new NavigationSystem(CreateFerry(), instructions);

            // Act
            var distance = navigationSystem.CalculateManhattanDistance();

            // Assert
            distance.Should().Be(286);
        }
예제 #2
0
        public void ShouldExecuteAllPossibleInstructionsAndCalculateManhattanDistance()
        {
            // Arrange
            var instructions = new List <string>
            {
                "N100",
                "S10",
                "E100",
                "W10",
                "F10",
                "R90",
                "F10",
                "L90",
                "F10"
            };

            var navigationSystem = new NavigationSystem(CreateShip(), instructions);

            // Act
            var distance = navigationSystem.CalculateManhattanDistance();

            // Assert
            distance.Should().Be(190);
        }