コード例 #1
0
            private static void StoreStations()
            {
                if (trainStations != null)
                    return;

                var client = new TransportTimesClient();
                var dotNetStations = client.GetAllTrainStations();

                var jsonStations = dotNetStations
                                        .Select(stn => new { id = stn.Id, value = stn.Name, label = $"{stn.Name} ({stn.Id})" });
                trainStations = new JavaScriptSerializer().Serialize(jsonStations);
            }
コード例 #2
0
        public void TestGetAllTrainStationsAlt2()
        {
            var sut = new TransportTimesClient();

            var allStations = sut.GetAllTrainStations();

            foreach (var station in allStations)
            {
                Console.WriteLine($"{station.Id} is {station.Name}");
            }

            Assert.IsTrue(allStations.Any(), "expect some stations back from irish rail service");
        }