示例#1
0
		/// <summary>
		/// Facade for parsing GTFS feed
		/// </summary>
		public GtfsFeed Parse(string feedPath)
		{
			GtfsFeedParserVisitor parser = new GtfsFeedParserVisitor(feedPath);
			GtfsFeed feed = new GtfsFeed();
			feed.Accept(parser);

			return parser.Feed;
		}
示例#2
0
		public void ParserReturnParsedGtfsFeedWithAtLeastOneRecordInEachProperty()
		{
			GtfsFeed feed = new GtfsFeed();
			feed.Accept(_sut);

			_output.WriteLine("_sut.Feed.Count: {0}", _sut.Feed.Agencies.Count);
			Assert.NotEmpty(_sut.Feed.Agencies);

			_output.WriteLine("_sut.Feed.Count: {0}", _sut.Feed.Calendars.Count);
			Assert.NotEmpty(_sut.Feed.Calendars);

			_output.WriteLine("_sut.Feed.CalendarDates.Count: {0}", _sut.Feed.CalendarDates.Count);
			Assert.NotEmpty(_sut.Feed.CalendarDates);

			_output.WriteLine("_sut.Feed.FareAttributes.Count: {0}", _sut.Feed.FareAttributes.Count);
			Assert.NotEmpty(_sut.Feed.FareAttributes);

			_output.WriteLine("_sut.Feed.FareRules.Count: {0}", _sut.Feed.FareRules.Count);
			Assert.NotEmpty(_sut.Feed.FareRules);

			_output.WriteLine("_sut.Feed.FeedInfos.Count: {0}", _sut.Feed.FeedInfos.Count);
			Assert.NotEmpty(_sut.Feed.FeedInfos);

			_output.WriteLine("_sut.Feed.Frequencies.Count: {0}", _sut.Feed.Frequencies.Count);
			Assert.NotEmpty(_sut.Feed.Frequencies);

			_output.WriteLine("_sut.Feed.Routes.Count: {0}", _sut.Feed.Routes.Count);
			Assert.NotEmpty(_sut.Feed.Routes);

			_output.WriteLine("_sut.Feed.Shapes.Count: {0}", _sut.Feed.Shapes.Count);
			Assert.NotEmpty(_sut.Feed.Shapes);

			_output.WriteLine("_sut.Feed.Stops.Count: {0}", _sut.Feed.Stops.Count);
			Assert.NotEmpty(_sut.Feed.Stops);

			_output.WriteLine("_sut.Feed.StopTimes.Count: {0}", _sut.Feed.StopTimes.Count);
			Assert.NotEmpty(_sut.Feed.StopTimes);

			_output.WriteLine("_sut.Feed.Transfers.Count: {0}", _sut.Feed.Transfers.Count);
			Assert.NotEmpty(_sut.Feed.Transfers);

			_output.WriteLine("_sut.Feed.Trips.Count: {0}", _sut.Feed.Trips.Count);
			Assert.NotEmpty(_sut.Feed.Trips);
		}
示例#3
0
		public void ParserDoesntReturnEmptyGtfsFeedProperties()
		{
			GtfsFeed feed = new GtfsFeed();
			feed.Accept(_sut);
			feed = _sut.Feed;

			Assert.NotNull(feed.Agencies);
			Assert.NotNull(feed.Calendars);
			Assert.NotNull(feed.CalendarDates);
			Assert.NotNull(feed.FareAttributes);
			Assert.NotNull(feed.FareRules);
			Assert.NotNull(feed.FeedInfos);
			Assert.NotNull(feed.Frequencies);
			Assert.NotNull(feed.Routes);
			Assert.NotNull(feed.Shapes);
			Assert.NotNull(feed.Stops);
			Assert.NotNull(feed.StopTimes);
			Assert.NotNull(feed.Transfers);
			Assert.NotNull(feed.Trips);
		}