public void Should_show_movement_info() { var airplane = new Airplane(); var terminal = Terminal.CreateWithSmartFortwo(new List <CrewMember>()); var output = new StringWriter(); Console.SetOut(output); _service.ShowMovementInfo(terminal, airplane); var expectedOutput = "Moving (Terminal => Airplane)\r\n\n*******************************************************************************************\r\n"; Assert.Equal(expectedOutput, output.ToString()); }
public TripDto Move(Place currentPlace, Place destinyPlace) { _tripInformerService.ShowMovementInfo(currentPlace, destinyPlace); if (!CurrentPlaceHasSmartFortwo(currentPlace)) { throw new Exception("The smart fortwo was not found!"); } if (!SmartFortwoAtCurrentPlaceHasDriver(currentPlace)) { throw new Exception("Smart Fortwo can't move without a driver"); } var currentPlaceMembersCanStayTogether = CrewChecker.CrewMembersAreAllowedToStayTogether(currentPlace.CrewMembers); var smartFortwoMembersCanStayTogether = CrewChecker.CrewMembersAreAllowedToStayTogether(currentPlace.GetSmartFortwoCrewMembers()); if (!currentPlaceMembersCanStayTogether || !smartFortwoMembersCanStayTogether) { throw new Exception("Some incompatible crew members are together alone or the prisoner is far from policeman"); } return(ChangePlaceOfSmartFortwo(currentPlace, destinyPlace)); }