public void ToStringMethodShouldReturnTheStringRepresentationOfTheHeadingEnum() { var expectedHeadingString = "N"; var sut = new Heading(HeadingEnum.North); Assert.AreEqual(expectedHeadingString, sut.ToString()); }
private void ExecuteInputCommand(InputCommand command) { switch (command) { case InputCommand.Left: CurrentHeading = (CurrentHeading.HeadingEnum == HeadingEnum.North) ? new Heading(HeadingEnum.West) : CurrentHeading = new Heading(CurrentHeading.HeadingEnum - 1); break; case InputCommand.Right: CurrentHeading = (CurrentHeading.HeadingEnum == HeadingEnum.West) ? new Heading(HeadingEnum.North) : CurrentHeading = new Heading(CurrentHeading.HeadingEnum + 1); break; case InputCommand.Move: switch (CurrentHeading.HeadingEnum) { case HeadingEnum.North: CurrentPosition = (CurrentPosition.Y == PlanetPlateau.UpperY) ? CurrentPosition : new Position(CurrentPosition.X, CurrentPosition.Y + 1); break; case HeadingEnum.East: CurrentPosition = (CurrentPosition.X == PlanetPlateau.UpperX) ? CurrentPosition : new Position(CurrentPosition.X + 1, CurrentPosition.Y); break; case HeadingEnum.South: CurrentPosition = (CurrentPosition.Y == PlanetPlateau.LowerY) ? CurrentPosition : new Position(CurrentPosition.X, CurrentPosition.Y - 1); break; case HeadingEnum.West: CurrentPosition = (CurrentPosition.X == PlanetPlateau.LowerX) ? CurrentPosition : new Position(CurrentPosition.X - 1, CurrentPosition.Y); break; default: break; } break; default: break; } }