Beispiel #1
0
        private static void StationServiceTest()
        {
            Console.WriteLine("Testing station service");
            stationService = Container.Resolve <IStationService>();
            stationService.CreateStation(new StationDTO
            {
                Name = "Ceska",
                Town = "Brno"
            });

            var brnoStations = stationService.GetAllStationsByTown("Brno");

            if (brnoStations == null || !brnoStations.Any())
            {
                Console.WriteLine("NOK: Not found any station in Brno");
            }
            else if (brnoStations.Where(station => station.Name == "Ceska") == null || !brnoStations.Any())
            {
                Console.WriteLine("NOK: Station Ceska in Brno not created");
            }
            else
            {
                Console.WriteLine("OK");
            }
            var stationCeska = stationService.GetStationById(brnoStations.First().ID);

            if (stationCeska.Name != "Ceska" || stationCeska.Town != "Brno")
            {
                Console.WriteLine("NOK: Not found station Ceska in Brno by Id");
            }
            else
            {
                Console.WriteLine("OK");
            }
            stationService.DeleteStation(stationCeska.ID);
            if (stationService.GetStationById(stationCeska.ID) != null)
            {
                Console.WriteLine("NOK: Station not deleted");
            }
            else
            {
                Console.WriteLine("OK");
            }
        }
Beispiel #2
0
 public StationDTO GetStationById(int stationID)
 {
     return stationService.GetStationById(stationID);
 }