public void TestToCheckIfUserInputValid(string passengerData) { var sut = new FlightBookingViewModel(); sut.AnalysePassengerInput(passengerData); Assert.That(sut.Passenger.IsUserInputValid, Is.EqualTo(true)); }
public void Setup() { if (flightBookingViewModel == null) { IEnumerable testData = FlightBookingTestData.TestCases; List <Passenger> passengers = new List <Passenger>(); flightBookingViewModel = new FlightBookingViewModel(); foreach (var data in testData) { flightBookingViewModel.AnalysePassengerInput(((TestCaseData)data).Arguments[0].ToString()); } } }
static void Main(string[] args) { string userInput = string.Empty; FlightBookingViewModel flightBookingViewModel = new FlightBookingViewModel(); UpdateConsoleToChooseOptions(); do { userInput = Console.ReadLine() ?? ""; try { flightBookingViewModel.AnalysePassengerInput(userInput); if (flightBookingViewModel.IsPrintRequired) { UpdateConsoleForInvalidInput(flightBookingViewModel.PrintText.ToString(), flightBookingViewModel.PrintTextColor); } } catch (Exception) { UpdateConsoleForInvalidInput(Constants.UNKOWNINPUT, ConsoleColor.Red); } } while (userInput != EPassengerSelection.Exit.ToString()); }