private void BtnAdd_Click(object sender, RoutedEventArgs e) { if (TxtAirlineID.Text.Equals("") || TxtDepCity.Text.Equals("") || TxtDesCity.Text.Equals("") || TxtDepDate.Text.Equals("") || TxtFlightTime.Text.Equals("")) { MessageBox.Show("All Fields Required", "Warning", MessageBoxButton.OK, MessageBoxImage.Exclamation); } else { try { Flight flight = new Flight(flightService.GetFlights().Count, int.Parse(TxtAirlineID.Text), TxtDepCity.Text, TxtDesCity.Text, TxtDepDate.Text, double.Parse(TxtFlightTime.Text)); flightService.Add(flight); RefreshList(); } catch (Exception ex) { MessageBox.Show("Please enter an integer for Airline ID ", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning); } } }
public void Add_Should_CallRepositoryCreate_When_Called() { _flightService.Add(_flightDTO); A.CallTo(() => _fakeUnitOfWork.FlightRepository.Create(_flight, null)).MustHaveHappenedOnceExactly(); }