public void WhereToNext_Finds_Direction_From_Start() { var asciiPathFinder = new ASCIIPathFinder(); var map1 = @" @A "; asciiPathFinder.LoadASCIIMap(map1); asciiPathFinder.GoToStart(); Assert.AreEqual(asciiPathFinder.WhereToNext(), Direction.Right); var map2 = @" @ | "; asciiPathFinder.LoadASCIIMap(map2); asciiPathFinder.GoToStart(); Assert.AreEqual(asciiPathFinder.WhereToNext(), Direction.Down); var map3 = @" +@ "; asciiPathFinder.LoadASCIIMap(map3); asciiPathFinder.GoToStart(); Assert.AreEqual(asciiPathFinder.WhereToNext(), Direction.Left); }
public void WhereToNext_Null_If_No_Path() { var asciiPathFinder = new ASCIIPathFinder(); var map1 = @" @ | B --+ | x--+ "; asciiPathFinder.LoadASCIIMap(map1); asciiPathFinder.GoToStart(); asciiPathFinder.Go(Direction.Down); asciiPathFinder.Go(Direction.Down); Assert.AreEqual(asciiPathFinder.CurrentChar, 'B'); Assert.AreEqual(asciiPathFinder.WhereToNext(), null); }
public void WhereToNext_Prefers_Maintaining_Direction() { var asciiPathFinder = new ASCIIPathFinder(); var map1 = @" @ | B--+ | | x--+ "; asciiPathFinder.LoadASCIIMap(map1); asciiPathFinder.GoToStart(); asciiPathFinder.Go(Direction.Down); asciiPathFinder.Go(Direction.Down); Assert.AreEqual(asciiPathFinder.CurrentChar, 'B'); Assert.AreEqual(asciiPathFinder.LastMovedInDirection, Direction.Down); Assert.AreEqual(asciiPathFinder.WhereToNext(), Direction.Down); }