示例#1
0
        public void T09AccessingRouteTest()
        {
            var api = TestHelper.Authenticate();
            var user = TestHelper.GetOrCreateUser(api);
            var problem = TestHelper.CreateProblemWithDemoData(api, user);
            var vehicle = TestHelper.GetVehicle(api, user, problem);
            api.Navigate<RouteData>(vehicle.GetLink("get-route"));
            var routeReq = new RouteUpdateRequest
            {
                Items = new[] {11, 12}
            };
            api.Navigate<ResponseData>(vehicle.GetLink("set-route"), routeReq);

            //##BEGIN EXAMPLE accessingroute##
            var route = api.Navigate<RouteData>(vehicle.GetLink("get-route"));
            //##END EXAMPLE##
            Trace.Write(JsonConvert.SerializeObject(route));
            var mockRoute = TestUtils.GetMockResponse<RouteData>(responses["accessingrouteresp"].json);
            ResponseWriter.Write(JsonConvert.SerializeObject(route, Formatting.Indented), "accessingrouteresp", responsePath + "/accessingrouteresp.dat");
            TestUtils.RoutesAreEqual(mockRoute, route);
        }
示例#2
0
        public void T10UpdatingRouteTest()
        {
            var api = TestHelper.Authenticate();
            var user = TestHelper.GetOrCreateUser(api);
            var problem = TestHelper.CreateProblemWithDemoData(api, user);
            var vehicle = TestHelper.GetVehicle(api, user, problem);

            //##BEGIN EXAMPLE updatingroute##
            api.Navigate<RouteData>(vehicle.GetLink("get-route"));
            var routeReq = new RouteUpdateRequest
            {
                Items = new[] {11, 21, 12, 22}
            };
            api.Navigate<ResponseData>(vehicle.GetLink("set-route"), routeReq);
            //##END EXAMPLE##
            var route = api.Navigate<RouteData>(vehicle.GetLink("get-route"));
            Trace.Write(JsonConvert.SerializeObject(route));
            var mockRoute = new[] {11, 21, 12, 22};
            Assert.AreEqual(mockRoute, route.Items);
        }
示例#3
0
        public void T08AccessingTaskSeqTest()
        {
            var api = TestHelper.Authenticate();
            var user = TestHelper.GetOrCreateUser(api);
            var problem = TestHelper.CreateProblemWithDemoData(api, user);
            var vehicle = TestHelper.GetVehicle(api, user, problem);

            api.Navigate<RouteData>(vehicle.GetLink("get-route"));
            var routeReq = new RouteUpdateRequest
            {
                Items = new[] {11, 12}
            };
            api.Navigate<ResponseData>(vehicle.GetLink("set-route"), routeReq);
            //##BEGIN EXAMPLE accessingtaskseq##
            var taskEvents = api.Navigate<TaskEventDataSet>(vehicle.GetLink("list-events"));
            //##END EXAMPLE##
            var mockTaskEvents = TestUtils.GetMockResponse<TaskEventDataSet>(responses["accessingtaskseqresp"].json);
            ResponseWriter.Write(JsonConvert.SerializeObject(taskEvents, Formatting.Indented), "accessingtaskseqresp", responsePath + "/accessingtaskseqresp.dat");
            TestUtils.TaskEventDataSetsAreEqual(mockTaskEvents, taskEvents);
        }