main
 1using System.Linq;
 2using mars.rover.common;
 3using mars.rover.domain;
 4using mars.rover.presentation;
 5using mars.rover.presentation.model;
 6
 7namespace mars.rover.service.application
 8{
 9    public class NavigateRoverCommand : ParameterizedCommand<string>
10    {
11        readonly Registry<Navigation> navigations;
12        readonly CaptureUserInstructionsView view;
13        NASA nasa;
14
15        public NavigateRoverCommand(Registry<Navigation> navigations, CaptureUserInstructionsView view, NASA nasa)
16        {
17            this.navigations = navigations;
18            this.nasa = nasa;
19            this.view = view;
20        }
21
22        public void run_against(string navigation_commands)
23        {
24            var rover = nasa.waiting();
25            navigation_commands.each(x => navigations.First(y => y.is_satisfied_by(x)).run_against(rover));
26            view.display(rover.ToString());
27        }
28    }
29}