コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
ファイル: Station.cs プロジェクト: r-t-a/Metars-app
 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
     });
 }
コード例 #4
0
        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);
        }
コード例 #5
0
        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();
                }
            }
        }
コード例 #6
0
        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();
            }
        }
コード例 #7
0
ファイル: Program.cs プロジェクト: maksonlee/grpc-example
        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));
        }
コード例 #8
0
        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);
        }
コード例 #9
0
        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();
                }
            }
        }
コード例 #10
0
        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);
        }
コード例 #11
0
        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";
            }
        }
コード例 #12
0
 public bool Update(StationResponse stationResponse)
 {
     return(_stationResponseDal.Modify(stationResponse));
 }
コード例 #13
0
 public bool Insert(StationResponse stationResponse)
 {
     return(_stationResponseDal.Add(stationResponse));
 }
コード例 #14
0
 public StationResult(StationResponse response, HttpStatusCode statusCode)
 {
     StationResponse = response;
     StatusCode      = statusCode;
 }