main
1using System.IO;
2
3namespace mars.rover.presentation
4{
5 public class CaptureUserInstructionsConsoleView : CaptureUserInstructionsView
6 {
7 readonly TextReader reader;
8 readonly TextWriter writer;
9
10 public CaptureUserInstructionsConsoleView(TextReader reader, TextWriter writer)
11 {
12 this.reader = reader;
13 this.writer = writer;
14 }
15
16 public void attach_to(CaptureUserInstructionsPresenter presenter)
17 {
18 writer.WriteLine("enter upper right coordinates:");
19 presenter.provide_upper_right_coordinates(reader.ReadLine());
20
21 for (var i = 0; i < 2; i++)
22 {
23 writer.WriteLine("enter coordinates to deploy a rover to:");
24 presenter.deploy_rover_to(reader.ReadLine());
25
26 writer.WriteLine("enter commands to navigate rover:");
27 presenter.navigate_rover_using(reader.ReadLine());
28 }
29 presenter.process_output();
30 }
31
32 public void display(string location)
33 {
34 writer.WriteLine(location);
35 }
36 }
37}