Beispiel #1
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
        public void LoadFromZip_OneRailStop()
        {
            TestStop expectedStop = new TestStop
            {
                StopId             = TestStopTime.SampleRailStopTime.StopId,
                StopCode           = "",
                StopName           = "FooTown",
                StopDesc           = "Foo Town",
                StopLat            = "42.519236",
                StopLon            = "-71.502643",
                ZoneId             = "",
                StopUrl            = "",
                LocationType       = 0,
                ParentStation      = "",
                WheelchairBoarding = 1
            };

            _helper.TargetFileName = "onetrainstop.zip";
            _helper.FeedInfos.Add(TestFeedInfo.Sample);
            _helper.Routes.Add(TestRoute.SampleCommuterRail);
            _helper.Trips.Add(TestTrip.SampleRailTrip);
            _helper.StopTimes.Add(TestStopTime.SampleRailStopTime);
            _helper.Stops.Add(expectedStop);
            _helper.MakeZipFile();

            Download target = new Download
            {
                download_date      = DateTime.Now,
                download_file_name = _helper.TargetFilePath
            };

            target.LoadFromZip();

            Assert.AreEqual(1, target.Stops.Count, "checking Stops.Count");
            var actualStop = target.Stops.ElementAt(0);

            Assert.AreEqual(expectedStop.StopId, actualStop.stop_id, "checking stop_id");
            Assert.AreEqual(expectedStop.StopCode, actualStop.stop_code, "checking stop_code");
            Assert.AreEqual(expectedStop.StopName, actualStop.stop_name, "checking stop_name");
            Assert.AreEqual(expectedStop.StopDesc, actualStop.stop_desc, "checking stop_desc");
            Assert.AreEqual(expectedStop.StopLat, actualStop.stop_lat_txt, "checking stop_lat_txt");
            Assert.AreEqual(expectedStop.StopLon, actualStop.stop_lon_txt, "checking stop_lon_txt");
            Assert.AreEqual(expectedStop.ZoneId, actualStop.zone_id, "checking zone_id");
            Assert.AreEqual(expectedStop.LocationType, actualStop.location_type, "checking location_type");
            Assert.AreEqual(expectedStop.ParentStation, actualStop.parent_station, "checking parent_station");
            Assert.AreEqual(expectedStop.WheelchairBoarding, actualStop.wheelchair_boarding, "checking wheelchair_boarding");
        }