public void MoveForwardFromNorth() { IOrientationReader orientationReader = new DummyOrientationReader("N"); var startingCoOrdinates = new CoOrdinates(0, 0); var strategies = new Dictionary <string, ILocationChangeStrategy>(); strategies.Add("N", new FacingNorth()); strategies.Add("E", new FacingEast()); strategies.Add("W", new FacingWest()); strategies.Add("S", new FacingSouth()); ILocationManager locationManager = new AlternativeLocationManager ( startingCoOrdinates , 100 , 100 , orientationReader , strategies ); locationManager.MoveForward(); var currentLocation = locationManager.GetCurrentLocation(); Assert.AreEqual("0,1", currentLocation, "Moving forward from 0,0 facing North does not give 0,1"); }
public AlternativeLocationManager ( CoOrdinates startingCoOrdinates , int max_X , int max_Y , IOrientationReader orientationReader , IDictionary <string, ILocationChangeStrategy> strategies ) { _coOrdinates = startingCoOrdinates; _max_X = max_X; _max_Y = max_Y; _orientationReader = orientationReader; _strategies = strategies; }
public void MoveForward(CoOrdinates coOrdinates) { coOrdinates.Increment_Y(); }
public void MoveBackward(CoOrdinates coOrdinates) { coOrdinates.Decrement_Y(); }
public void MoveForward(CoOrdinates coOrdinates) { coOrdinates.Decrement_X(); }
public void MoveBackward(CoOrdinates coOrdinates) { coOrdinates.Increment_X(); }