// Use this for initialization void Start() { displayText = GetComponentInChildren <Text>(); airportController = GameObject.Find("GameController").GetComponent <AirportController>(); StartCoroutine(UpdateBoardInfo()); }
public void loadAirportData() { dataSanBay.ItemsSource = null; lstSB = AirportController.loadAirportData(); dataSanBay.ItemsSource = lstSB; lblSoSB.Content = lstSB.Count(); }
private void BtnSearch_Click(object sender, RoutedEventArgs e) { switch (cmbFilter.SelectedIndex) { case 0: { if (txtSearchBox.Text.Length > 5) { MessageBox.Show("Mã sân bay chi có 5 kí tự"); } else { AirportController.searchByID(ref lstSB, txtSearchBox.Text); dataSanBay.ItemsSource = lstSB; } break; } case 1: { AirportController.searchByTen(ref lstSB, txtSearchBox.Text); dataSanBay.ItemsSource = lstSB; break; } case 2: { AirportController.searchByDiaDiem(ref lstSB, txtSearchBox.Text); dataSanBay.ItemsSource = lstSB; break; } default: break; } }
public AirportControllerTest() { this.fixture = new Fixture(); this.airportAppServiceMock = new Mock <IAirportAppService>(); this.airportServiceMock = new Mock <IAirportService>(); this.airportRepositoryMock = new Mock <IAirportRepository>(); this.imapperMock = new Mock <IMapper>(); this.ihttpClientMock = new Mock <IHttpClientFactory>(); //auto mapper configuration var mockMapper = new MapperConfiguration(cfg => { cfg.AddProfile(new AutoMapperConfig()); }); var mapper = mockMapper.CreateMapper(); this.airportController = new AirportController( this.airportAppServiceMock.Object, mapper: mapper); this.airportAppService = new AirportAppService( this.airportServiceMock.Object); this.airportService = new AirportService( this.airportRepositoryMock.Object); this.airportRepository = new AirportRepository( this.ihttpClientMock.Object); }
private void BtnConfirm_Click(object sender, RoutedEventArgs e) { if (Checking()) { StringBuilder sb = new StringBuilder(txtMaSB.Text); int l = sb.Length; while (l < 4) { l++; sb.Append(" "); } if (AirportController.validateAirport(sb.ToString())) { AirportController.addNewAirport(sb.ToString(), txtTenSB.Text, txtDiaDiem.Text); this.Visibility = Visibility.Collapsed; } else { MessageBox.Show("Đã tồn tại mã sân bay này rồi"); } } else { MessageBox.Show(error.ToString()); error.Clear(); } }
public void GetAirportByCodeNull() { var controller = new AirportController(new TestAirportService(new Airport { Name = "Name", Code = "Code", City = "City", TimeZone = 999 }), new TestLoggingService()); controller.Get(null); }
public void Index() { // Arrange var controller = new AirportController(); // Act var result = controller.Index(); // Assert Assert.IsNotNull(result); }
public void GetReturnsIEnumerableAirportViewModelObject() { // Arrange var airportRepository = new AirportRepository(airportServiceMock.Object, mapper); var airportController = new AirportController(airportRepository); // Act var results = airportController.Get(); // Assert Assert.IsInstanceOfType(results, typeof(IEnumerable <AirportViewModel>)); }
public static void Main(string[] args) { IAirport airport = new Airport(); IAirportController airportController = new AirportController(airport); IFlightController flightController = new FlightController(airport); IReader reader = new ConsoleReader(); IWriter writer = new ConsoleWriter(); IEngine engine = new Engine(reader, writer, airportController, flightController); engine.Run(); }
public void GetAirportByCode() { var controller = new AirportController(new TestAirportService(new Airport { Name = "Name", Code = "Code", City = "City", TimeZone = 999 }), new TestLoggingService()); var airportViewModel = controller.Get("Code"); Assert.IsNotNull(airportViewModel, "airportViewModel != null"); Assert.AreEqual(airportViewModel.Code, "Code"); Assert.AreEqual(airportViewModel.City, "City"); Assert.AreEqual(airportViewModel.Name, "Name"); Assert.AreEqual(airportViewModel.TimeZone, 999); }
public void GetReturnsMultipleAirportViewModelObjects() { // Arrange var airportRepository = new AirportRepository(airportServiceMock.Object, mapper); var airportController = new AirportController(airportRepository); // Act var results = airportController.Get(); var resultsData = results as List <AirportViewModel>; // Assert Assert.AreEqual(2, resultsData.Count); }
static void Main() { IReader reader = new ConsoleReader(); IWriter writer = new ConsoleWriter(); var airport = new Airport(); var airportController = new AirportController(airport); var flightController = new FlightController(airport); var engine = new Engine(reader, writer, airportController, flightController); engine.Run(); }
public void SheduleDeleteDeparture_When_All_Args_IsOk_When_Should_Return_CreatedResult_And_Add_Departure_To_dB_And_Then_Delete() { // Arrange #region ControllerInit MSSQLContext context = new MSSQLContext(); PlaneTypesRepository planeTypesRepository = new PlaneTypesRepository(); PlanesRepository planesRepository = new PlanesRepository(); AircraftUnitOfWork uow = new AircraftUnitOfWork(planesRepository, planeTypesRepository, context); AircraftService service = new AircraftService(uow); CrewsRepository crewsRepository = new CrewsRepository(); PilotsRepository pilotsRepository = new PilotsRepository(); StewardessesRepository stewardessesRepository = new StewardessesRepository(); CrewingUnitOfWork cuow = new CrewingUnitOfWork(crewsRepository, pilotsRepository, stewardessesRepository, context); CrewingService crewingService = new CrewingService(cuow); FlightsRepository flightRepository = new FlightsRepository(); DeparturesRepository departuresRepository = new DeparturesRepository(); TicketsRepository ticketsRepository = new TicketsRepository(); FlightOperationsUnitOfWork flightOpUow = new FlightOperationsUnitOfWork(flightRepository, ticketsRepository, departuresRepository, context); FlightOperationsService flightOpeService = new FlightOperationsService(flightOpUow); AiroportService airportService = new AiroportService(service, crewingService, flightOpeService); AirportController controller = new AirportController(mapper.GetDefaultMapper(), airportService); #endregion var departureDto = new DepartureDTO() { CrewId = crewId, DepartureTime = new DateTime(2018, 8, 10, 11, 0, 0), PlaneId = 2, FlightId = 1 }; var addResult = controller.SheduleDeparture(departureDto); // add assert Assert.IsInstanceOf <CreatedResult>(addResult); Assert.IsInstanceOf <DepartureDTO>((addResult as CreatedResult).Value); // delete act var addedDepartureDTO = (addResult as CreatedResult).Value as DepartureDTO; var deleteResult = controller.DeleteDeparture(addedDepartureDTO.Id); // delete assert Assert.IsInstanceOf <OkResult>(deleteResult); Assert.IsNull(departuresRepository.Get(addedDepartureDTO.Id)); }
public static void Main(string[] args) { IReader reader = new ConsoleReader(); IWriter writer = new ConsoleWriter(); IAirplaneFactory airplaneFactory = new AirplaneFactory(); IItemFactory itemFactory = new ItemFactory(); IAirport airport = new Airport(); var airportController = new AirportController(airport, airplaneFactory, itemFactory); var flightController = new FlightController(airport); var engine = new Engine(reader, writer, airportController, flightController); engine.Run(); }
private void BtnOK_Click(object sender, RoutedEventArgs e) { if (parent.isEditting == true) { if (txtTenSB.Text == "" || txtDiaDiem.Text == "") { MessageBox.Show("Tên sân bay hoặc địa điểm vẫn còn trống"); } else { AirportController.updateAirport(GlobalItem.selectedAirport.MaSB, txtTenSB.Text, txtDiaDiem.Text); } } this.Visibility = Visibility.Collapsed; }
public void GetAllAirports() { var controller = new AirportController(new TestAirportService(new Airport { Name = "Name", Code = "Code", City = "City", TimeZone = 999 }), new TestLoggingService()); var airports = controller.Get(); Assert.IsNotNull(airports, "airports != null"); Assert.AreEqual(airports.Count(), 1); foreach (var airportViewModel in airports) { Assert.AreEqual(airportViewModel.Code, "Code"); Assert.AreEqual(airportViewModel.City, "City"); Assert.AreEqual(airportViewModel.Name, "Name"); Assert.AreEqual(airportViewModel.TimeZone, 999); } }
public static void Main(string[] args) { IReader reader = new ConsoleReader(); //if (args.Length == 1) //{ // var testPath = args.First(); //} //else //{ // reader = new ConsoleReader(); //} IWriter writer = new ConsoleWriter(); IAirport airport = new Airport(); var airportController = new AirportController(airport); var flightController = new FlightController(airport); var engine = new Engine(reader, writer, airportController, flightController); engine.Run(); }
private void UserControl_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e) { DependencyObject ucParent = this.Parent; if (!(ucParent is UserControl)) { ucParent = LogicalTreeHelper.GetParent(ucParent); } parent = (scheduleMng)ucParent; if (this.Visibility == Visibility.Visible) { txtMaSB.Text = GlobalItem.selectedAirport.MaSB; txtTenSB.Text = GlobalItem.selectedAirport.TenSB; txtDiaDiem.Text = GlobalItem.selectedAirport.DiaDiem; lblSBTitle.Content = "Sân bay " + txtTenSB.Text; lblTitleOfData.Content = "Danh sách các chuyến bay bắt đầu/kết thúc ở " + txtTenSB.Text; dataChuyenBay.ItemsSource = AirportController.searchCBForMASB(txtMaSB.Text); if (parent.isEditting) { manChe.Visibility = Visibility.Hidden; } else { manChe.Visibility = Visibility.Visible; } } else { parent.isEditting = false; GlobalItem.selectedAirport = null; parent.loadAirportData(); } }
public static void Main(string[] args) { IReader reader; if (args.Length == 1) { var testPath = args.First(); reader = new Core.IO.StringReader(File.ReadAllText(testPath)); } else { reader = new ConsoleReader(); } IWriter writer = new ConsoleWriter(); IAirport airport = new Airport(new List <IBag>(), new List <IBag>(), new List <ITrip>(), new List <IPassenger>()); IAirportController airportController = new AirportController(airport); IFlightController flightController = new FlightController(airport); IEngine engine = new Engine(reader, writer, airportController, flightController); engine.Run(); }
public static void Main(string[] args) { IReader reader; if (args.Length == 1) { var testPath = args.First(); reader = new Core.IO.StringReader(File.ReadAllText(testPath)); } else { reader = new ConsoleReader(); } IWriter writer = new ConsoleWriter(); var airport = new Airport(); var airportController = new AirportController(airport); var flightController = new FlightController(airport); var engine = new Engine(reader, writer, airportController, flightController); engine.ВдигниСамолета(); }
// Use this for initialization void Start() { aptController = FindObjectOfType <AirportController>(); }
public AirportControllerTests() { _controller = new AirportController(); }
private void BtnDelete_Click(object sender, RoutedEventArgs e) { AirportController.deleteAirport((SANBAY)dataSanBay.SelectedItem); dataSanBay.ItemsSource = null; loadAirportData(); }