public void SearchTestWithCompleteAndIncompleteTerms() { //Arrange var controller = new TicketController(new StationService(new StationRepository(new CacheStation(new DbContext())))); var expected = new StationResponse { Stations = new List <string> { "LIVERPOOL", "LIVERPOOL LIME STREET" }, NextCharacters = new List <string> { " " } }; //Act var result = controller.GetStation("LIVERPOOL") as OkNegotiatedContentResult <StationResponse>; //Assert Assert.IsNotNull(result.Content); CollectionAssert.AreEqual(expected.Stations, result.Content.Stations); CollectionAssert.AreEqual(expected.NextCharacters, result.Content.NextCharacters); }
private StationResponse Get(int rowIndex) { StationResponse stationResponse = new StationResponse(); stationResponse.ID = (int)GetValue(rowIndex, 0); stationResponse.ResponseId = (int)GetValue(rowIndex, 1); stationResponse.StationId = (int)GetValue(rowIndex, 2); stationResponse.NumberOfVehicles = (int)GetValue(rowIndex, 3); stationResponse.VehicleTypeId = (int)GetValue(rowIndex, 4); return(stationResponse); }
public static Station MapFromResponse(StationResponse stationResponse) { return(new Station { Name = stationResponse.Name, Note = stationResponse.Note, AirportIdentifier = stationResponse.ICAO, Latitude = stationResponse.Latitude, Longitude = stationResponse.Longitude, Elevation = stationResponse.Elevation, RunwayCount = stationResponse.Runways.Count }); }
public static StationApiModel FromStationResponse(StationResponse stationResponse) { var model = new StationApiModel() { Id = stationResponse.Id, Latitude = stationResponse.Latitude, Longitude = stationResponse.Longitude, Address = stationResponse.Name, City = "New York", Country = "USA" }; return(model); }
private void deleteToolStripMenuItem_Click(object sender, EventArgs e) { var rowIndex = dgvStationResponseList.SelectedRows[0].Index; StationResponse stationResponse = Get(rowIndex); if (stationResponse != null) { if (MessageBox.Show("A je i sigurte", "Jeni duke fshire", MessageBoxButtons.OKCancel) == DialogResult.OK) { _stationResponseService.Delete(stationResponse.ID); RefreshStationResponseList(); } } }
private void editToolStripMenuItem_Click(object sender, EventArgs e) { var rowIndex = dgvStationResponseList.SelectedRows[0].Index; StationResponse stationResponse = Get(rowIndex); if (stationResponse != null) { StationResponseForm frm = new StationResponseForm(stationResponse); frm.Text = "Edit StationResponse"; frm.TopLevel = false; frm.MdiParent = this.MdiParent; frm.Show(); } }
public override Task <StationResponse> GetItemStations(Imei request, ServerCallContext context) { List <Station> stations = new List <Station>() { new Station { Name = "download" }, new Station { Name = "packing" } }; StationResponse response = new StationResponse(); response.Stations.Add(stations); return(Task.FromResult(response)); }
public void SearchTestWithUnexistentTerm() { //Arrange var controller = new TicketController(new StationService(new StationRepository(new CacheStation(new DbContext())))); var expected = new StationResponse { Message = "Station Not Found." }; //Act var result = controller.GetStation("KING CROSS") as OkNegotiatedContentResult <StationResponse>; //Assert Assert.IsNotNull(result.Content); Assert.AreEqual(expected.Message, result.Content.Message); }
private void dgvStationResponseList_CellContentClick(object sender, DataGridViewCellEventArgs e) { var rowIndex = e.RowIndex; if (rowIndex >= 0) { StationResponse stationResponse = Get(rowIndex); if (stationResponse != null) { StationResponseForm frm = new StationResponseForm(stationResponse); frm.Name = "Edit StationResponse"; frm.TopLevel = false; frm.MdiParent = this.MdiParent; frm.Show(); } } }
public async Task <StationResponse> GetAllStations() { var stgStations = new StationResponse(); try { HttpClient _client = new HttpClient(); _client.BaseAddress = new Uri(stationUrl); _client.Timeout = TimeSpan.FromMinutes(120); var stationList = await _client.GetAsync(stationUrl + "/data/stations/v1/all").ConfigureAwait(false); stgStations = JsonConvert.DeserializeObject <StationResponse>(stationList.Content.ReadAsStringAsync().Result); } catch (Exception) { } return(stgStations); }
private void CmbResponseId_SelectedIndexChanged(object sender, EventArgs e) { ComboBox comboBox = (ComboBox)sender; StationResponse responseSelected = (StationResponse)comboBox.SelectedItem; if (responseSelected != null) { //Is Emergency service needed ResponseBLL responseBll = new ResponseBLL(); Response response = responseBll.Get(responseSelected.ResponseId); chbIsEmergency.Checked = response.Emergency; requiredVehicles = responseSelected.NumberOfVehicles; //Number of vehicles lblComment.Text = requiredVehicles.ToString() + " vehicles required"; } }
public bool Update(StationResponse stationResponse) { return(_stationResponseDal.Modify(stationResponse)); }
public bool Insert(StationResponse stationResponse) { return(_stationResponseDal.Add(stationResponse)); }
public StationResult(StationResponse response, HttpStatusCode statusCode) { StationResponse = response; StatusCode = statusCode; }