Esempio n. 1
0
        public void Part1_Example_Step1()
        {
            var command = NavigationCommand.FromString("F10");

            var ship = new Ship();

            ship.ProcessCommand(command);

            ship.Direction.Should().Be(Direction.East);
            ship.X.Should().Be(10);
            ship.Y.Should().Be(0);
        }
Esempio n. 2
0
        public void Part2_Example_Step1()
        {
            var ship    = new Ship();
            var command = NavigationCommand.FromString("F10");

            ship.ProcessWaypointCommand(command);

            ship.X.Should().Be(100);
            ship.Y.Should().Be(10);
            ship.Waypoint.X.Should().Be(10);
            ship.Waypoint.Y.Should().Be(1);
        }
Esempio n. 3
0
        public void Part1_Example_Step5()
        {
            var command = NavigationCommand.FromString("F11");

            var ship = new Ship()
            {
                X = 17, Y = 3, Direction = Direction.South
            };

            ship.ProcessCommand(command);

            ship.Direction.Should().Be(Direction.South);
            ship.X.Should().Be(17);
            ship.Y.Should().Be(-8);
        }
Esempio n. 4
0
        public void Part1_Example_Step3()
        {
            var command = NavigationCommand.FromString("F7");

            var ship = new Ship()
            {
                X = 10, Y = 3
            };

            ship.ProcessCommand(command);

            ship.Direction.Should().Be(Direction.East);
            ship.X.Should().Be(17);
            ship.Y.Should().Be(3);
        }
Esempio n. 5
0
        public void Part2_Example_Step5()
        {
            var ship = new Ship()
            {
                X        = 170,
                Y        = 38,
                Waypoint = new Waypoint {
                    X = 4, Y = -10
                }
            };
            var command = NavigationCommand.FromString("F11");

            ship.ProcessWaypointCommand(command);

            ship.X.Should().Be(214);
            ship.Y.Should().Be(-72);
            ship.Waypoint.X.Should().Be(4);
            ship.Waypoint.Y.Should().Be(-10);
        }
Esempio n. 6
0
        public void Part2_Example_Step4()
        {
            var ship = new Ship()
            {
                X        = 170,
                Y        = 38,
                Waypoint = new Waypoint {
                    X = 10, Y = 4
                }
            };
            var command = NavigationCommand.FromString("R90");

            ship.ProcessWaypointCommand(command);

            ship.X.Should().Be(170);
            ship.Y.Should().Be(38);
            ship.Waypoint.X.Should().Be(4);
            ship.Waypoint.Y.Should().Be(-10);
        }