public void GeometryIntegrationSuccessTest()
        {
            
            var token = EnvironmentHelper.GetEnvironmentVariable("TravelPlannerClientApiToken");
            var client = new TravelPlannerClient(token)
            {
                GzipEnabled = true
            };
            var result = client.Geometry(new GeometryRequest
            {
                Ref = "54"
            });
            Assert.IsTrue(result.StatusCode == StatusCode.Ok);

        }
Ejemplo n.º 2
0
        public void GeometryTest()
        {
            var fakekey = "fakekey";
            var journeref = "873021%2F296594%2F776520%2F97255%2F74%26startIdx%3D7%26endIdx%3D8%26lang%3Dsv%26format%3Djson%26";

            var httpRequest = HttpRequestMocker.GetMockedRequesterFor(
                new Uri(
                    "https://api.sl.se/api2/TravelplannerV2/geometry.json/?ref=" + journeref + "&key=" +
                    fakekey),

                GetGeometryResponseSample());
            var t = new TravelPlannerClient(new HttpClient("https://api.sl.se/", httpRequest, new UrlHelper())
            {
                ApiToken = fakekey
            });
            var result = t.Geometry(new GeometryRequest { Ref = journeref });
            var point = result.Geometry.Points.Point.FirstOrDefault();
            Assert.IsTrue(point != null);
            Assert.IsTrue(Math.Abs(point.Latitude - 59.361337) < 0.001);
            Assert.IsTrue(Math.Abs(point.Longitude - 17.996278) < 0.001);
        }