Пример #1
0
 public void TripTest()
 {
     var fakekey = "fakekey";
     var mockedHttpRequest = HttpRequestMocker.GetMockedRequesterFor(new Uri(
                     "https://api.sl.se/api2/TravelplannerV2/trip.json/?date=2015-09-07&time=22:00&originId=9305&destId=9001&key=" + fakekey), GetTestResponse());
     var t = new TravelPlannerClient(new HttpClient("https://api.sl.se/", mockedHttpRequest, new UrlHelper())
     {
         ApiToken = fakekey
     });
     var result = t.Trip(new TripRequest {DateTime = new DateTime(2015,9, 7,22,0,0,DateTimeKind.Local),OriginId = "9305", DestId = "9001" });
     var f = result.TripList.Trip.FirstOrDefault();
     Assert.IsTrue(f != null);
     var leg = f.LegList.Leg.FirstOrDefault();
     Assert.IsTrue(leg != null);
     Assert.IsTrue(leg.Direction == "Kungsträdgården");
 }