Skip to content

Commit

Permalink
Fix no outbound green line trams. Brides glen name should have no apo…
Browse files Browse the repository at this point in the history
…strophe
  • Loading branch information
eoinobrien committed Jun 25, 2024
1 parent 324650b commit a43efc8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
21 changes: 20 additions & 1 deletion LuasAPI.NET.Tests/Models/StationForcastTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public void CreateStationForecastFromRealTimeInfo_StationsIsNull_ThrowsArgumentE
}

[Fact]
public void CreateStationForecastFromRealTimeInfo_()
public void CreateStationForecastFromRealTimeInfo_1()
{
UnitTestStationInformationLoader loader = new UnitTestStationInformationLoader();
loader.AddStations(new Station() { Abbreviation = "STS", Name = "St. Stephen's Green", IsInUse = true });
Expand All @@ -51,6 +51,25 @@ public void CreateStationForecastFromRealTimeInfo_()
Assert.Single(forecast.OutboundTrams);
}

[Fact]
public void CreateStationForecastFromRealTimeInfo_2()
{
UnitTestStationInformationLoader loader = new UnitTestStationInformationLoader();
loader.AddStations(new Station() { Abbreviation = "STI", Name = "Stillorgan", IsInUse = true });
loader.AddStations(new Station() { Abbreviation = "BRI", Name = "Bride's Glen", IsInUse = true });
loader.AddStations(new Station() { Abbreviation = "SAN", Name = "Sandyford", IsInUse = true });

Stations stations = new Stations(loader);

RealTimeInfo realTimeInfo = CreateRealTimeInfoFromXml("<stopInfo created = \"2024-06-25T00:47:32\" stop=\"Stillorgan\" stopAbv=\"STI\"><message>Green Line services operating normally</message><direction name = \"Inbound\"><tram destination=\"No trams forecast\" dueMins=\"\" /></direction><direction name = \"Outbound\"><tram dueMins=\"12\" destination=\"Brides Glen\" /></direction></stopInfo>");

StationForecast forecast = StationForecast.CreateStationForecastFromRealTimeInfo(realTimeInfo, stations);

Assert.Equal(realTimeInfo.Stop, forecast.Station.Name);
Assert.Empty(forecast.InboundTrams);
Assert.Single(forecast.OutboundTrams);
}

private RealTimeInfo CreateRealTimeInfoFromXml(string xml)
{
XmlSerializer serializer = new XmlSerializer(typeof(RealTimeInfo));
Expand Down
8 changes: 4 additions & 4 deletions LuasAPI.NET/StationInformation/Stations.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
{
"DEP": {
"abbreviation": "DEP",
"name": "Depot",
Expand Down Expand Up @@ -5190,9 +5190,9 @@
},
"BRI": {
"abbreviation": "BRI",
"name": "Bride's Glen",
"name": "Brides Glen",
"irishName": "Gleann Bhríde",
"pronunciation": "bride's glen",
"pronunciation": "brides glen",
"line": "Green",
"hasParking": false,
"hasCycleParking": false,
Expand Down Expand Up @@ -5258,4 +5258,4 @@
}
}
}
}
}

0 comments on commit a43efc8

Please sign in to comment.