public void FindClosestFacilityTest_Point_Geometry()
        {
            string networkDatasetName = "RoadNet@Changchun";
            Point2D[] facilities = new Point2D[3];
            facilities[0] = new Point2D(70.1515638201, -54.7406354454);
            facilities[1] = new Point2D(550.6770595320, -56.1050211383);
            facilities[2] = new Point2D(445.6471889264, -229.2074549041);
            Point2D eventPoint = new Point2D(119.6100397551, -122.6278394459);
            int expectFacilityCount = 2;
            bool fromEvent = false;
            double maxWeight = 0;
            TransportationAnalystParameter parameter = new TransportationAnalystParameter();
            parameter.WeightFieldName = "length";
            parameter.TurnWeightField = "TurnCost";
            parameter.ResultSetting = new TransportationAnalystResultSetting();
            parameter.ResultSetting.ReturnEdgeFeatures = false;
            parameter.ResultSetting.ReturnEdgeGeometry = true;
            parameter.ResultSetting.ReturnEdgeIDs = true;
            parameter.ResultSetting.ReturnNodeFeatures = false;
            parameter.ResultSetting.ReturnNodeGeometry = true;
            parameter.ResultSetting.ReturnNodeIDs = true;
            parameter.ResultSetting.ReturnPathGuides = true;
            parameter.ResultSetting.ReturnRoutes = true;

            NetworkAnalyst networkAnalyst = new NetworkAnalyst("http://" + ip + ":8090/iserver/services/transportationanalyst-sample/rest");
            List<ClosestFacilityPath<Point2D>> pathResult = networkAnalyst.FindClosestFacility(networkDatasetName, facilities,
                eventPoint, expectFacilityCount, fromEvent, maxWeight, parameter);
            Assert.IsNotNull(pathResult);
            Assert.AreEqual(pathResult.Count, 2);
            Assert.AreEqual(pathResult[0].FacilityIndex, 0);
            Assert.AreEqual(pathResult[0].Facility.X, 70.1515638201);
            Assert.AreEqual(pathResult[0].Facility.Y, -54.7406354454);
            Assert.AreEqual(pathResult[1].FacilityIndex, 1);
            Assert.AreEqual(pathResult[1].Facility.X, 550.677059532);
            Assert.AreEqual(pathResult[1].Facility.Y, -56.1050211383);
            Assert.AreEqual(pathResult[0].Weight, 125);
            Assert.AreEqual(pathResult[1].Weight, 484);
            Assert.IsNotNull(pathResult[0].StopWeights);
            Assert.IsNotNull(pathResult[0].Route);
            Assert.IsNotNull(pathResult[0].PathGuideItems);
            Assert.IsNotNull(pathResult[0].NodeIDs);
            Assert.IsNotNull(pathResult[0].EdgeIDs);
        }
        public void FindClosestFacilityTest_Point_TAParameterNULL()
        {
            string networkDatasetName = "RoadNet@Changchun";
            Point2D[] facilities = new Point2D[3];
            facilities[0] = new Point2D(70.1515638201, -54.7406354454);
            facilities[1] = new Point2D(550.6770595320, -56.1050211383);
            facilities[2] = new Point2D(445.6471889264, -229.2074549041);
            Point2D eventPoint = new Point2D(119.6100397551, -122.6278394459);
            int expectFacilityCount = 2;
            bool fromEvent = false;
            double maxWeight = 0;

            NetworkAnalyst networkAnalyst = new NetworkAnalyst("http://" + ip + ":8090/iserver/services/transportationanalyst-sample/rest");
            List<ClosestFacilityPath<Point2D>> pathResult = networkAnalyst.FindClosestFacility(networkDatasetName, facilities,
                eventPoint, expectFacilityCount, fromEvent, maxWeight, null);
            Assert.IsNotNull(pathResult);
            Assert.AreEqual(pathResult.Count, 2);
            Assert.AreEqual(pathResult[0].FacilityIndex, 0);
            Assert.AreEqual(pathResult[0].Facility.X, 70.1515638201);
            Assert.AreEqual(pathResult[0].Facility.Y, -54.7406354454);
            Assert.AreEqual(pathResult[1].FacilityIndex, 1);
            Assert.AreEqual(pathResult[1].Facility.X, 550.677059532);
            Assert.AreEqual(pathResult[1].Facility.Y, -56.1050211383);
            Assert.AreEqual(pathResult[0].Weight, 125);
            Assert.AreEqual(pathResult[1].Weight, 454);
            Assert.IsNotNull(pathResult[0].Route);
            Assert.IsNull(pathResult[0].PathGuideItems);
            Assert.IsNotNull(pathResult[0].NodeIDs);
            Assert.IsNull(pathResult[0].NodeFeatures);
            Assert.IsNull(pathResult[0].EdgeFeatures);
            Assert.IsNotNull(pathResult[0].EdgeIDs);
        }
        public void FindClosestFacilityTest_Point_DatasetNULL()
        {
            //string networkDatasetName = "RoadNet@Changchun";
            Point2D[] facilities = new Point2D[3];
            facilities[0] = new Point2D(70.1515638201, -54.7406354454);
            facilities[1] = new Point2D(550.6770595320, -56.1050211383);
            facilities[2] = new Point2D(445.6471889264, -229.2074549041);
            Point2D eventPoint = new Point2D(119.6100397551, -122.6278394459);
            int expectFacilityCount = 2;
            bool fromEvent = false;
            double maxWeight = 0;
            TransportationAnalystParameter parameter = new TransportationAnalystParameter();
            parameter.WeightFieldName = "length";
            parameter.TurnWeightField = "TurnCost";

            NetworkAnalyst networkAnalyst = new NetworkAnalyst("http://" + ip + ":8090/iserver/services/transportationanalyst-sample/rest");
            try
            {
                List<ClosestFacilityPath<Point2D>> pathResult = networkAnalyst.FindClosestFacility(string.Empty, facilities,
                    eventPoint, expectFacilityCount, fromEvent, maxWeight, parameter);
            }
            catch (ArgumentException e)
            {
                Assert.AreEqual(e.Message, "参数不能为空。\r\n参数名: networkDatasetName");
            }
        }
        public void FindClosestFacilityTest_ID_Geometry()
        {
            string networkDatasetName = "RoadNet@Changchun";
            int[] facilityIDs = new int[] { 1, 6, 52 };
            int eventID = 2;
            int expectFacilityCount = 2;
            bool fromEvent = false;
            double maxWeight = 0;
            TransportationAnalystParameter parameter = new TransportationAnalystParameter();
            parameter.WeightFieldName = "length";
            parameter.TurnWeightField = "TurnCost";
            parameter.ResultSetting = new TransportationAnalystResultSetting();
            parameter.ResultSetting.ReturnEdgeFeatures = false;
            parameter.ResultSetting.ReturnEdgeGeometry = true;
            parameter.ResultSetting.ReturnEdgeIDs = true;
            parameter.ResultSetting.ReturnNodeFeatures = false;
            parameter.ResultSetting.ReturnNodeGeometry = true;
            parameter.ResultSetting.ReturnNodeIDs = true;
            parameter.ResultSetting.ReturnPathGuides = true;
            parameter.ResultSetting.ReturnRoutes = true;

            NetworkAnalyst networkAnalyst = new NetworkAnalyst("http://" + ip + ":8090/iserver/services/transportationanalyst-sample/rest");
            List<ClosestFacilityPath<int>> pathResult = networkAnalyst.FindClosestFacility(networkDatasetName, facilityIDs,
                eventID, expectFacilityCount, fromEvent, maxWeight, parameter);
            Assert.IsNotNull(pathResult);
            Assert.AreEqual(pathResult.Count, 2);
            Assert.AreEqual(pathResult[0].FacilityIndex, 0);
            Assert.AreEqual(pathResult[0].Facility, 1);
            Assert.AreEqual(pathResult[1].FacilityIndex, 1);
            Assert.AreEqual(pathResult[1].Facility, 6);
            Assert.AreEqual(pathResult[0].Weight, 125);
            Assert.AreEqual(pathResult[1].Weight, 484);
            Assert.IsNotNull(pathResult[0].StopWeights);
            Assert.IsNotNull(pathResult[0].Route);
            Assert.IsNotNull(pathResult[0].PathGuideItems);
            Assert.IsNotNull(pathResult[0].NodeIDs);
            Assert.IsNotNull(pathResult[0].EdgeIDs);
        }
        public void FindClosestFacilityTest_ID_TAParameterNULL()
        {
            string networkDatasetName = "RoadNet@Changchun";
            int[] facilityIDs = new int[] { 1, 6, 52 };
            int eventID = 2;
            int expectFacilityCount = 2;
            bool fromEvent = false;
            double maxWeight = 0;

            NetworkAnalyst networkAnalyst = new NetworkAnalyst("http://" + ip + ":8090/iserver/services/transportationanalyst-sample/rest");
            List<ClosestFacilityPath<int>> pathResult = networkAnalyst.FindClosestFacility(networkDatasetName, facilityIDs,
                eventID, expectFacilityCount, fromEvent, maxWeight, null);
            Assert.IsNotNull(pathResult);
            Assert.AreEqual(pathResult.Count, 2);
            Assert.AreEqual(pathResult[0].FacilityIndex, 0);
            Assert.AreEqual(pathResult[0].Facility, 1);
            Assert.AreEqual(pathResult[1].FacilityIndex, 1);
            Assert.AreEqual(pathResult[1].Facility, 6);
            Assert.AreEqual(pathResult[0].Weight, 125);
            Assert.AreEqual(pathResult[1].Weight, 454);
            Assert.IsNotNull(pathResult[0].Route);
            Assert.IsNull(pathResult[0].PathGuideItems);
            Assert.IsNotNull(pathResult[0].NodeIDs);
            Assert.IsNull(pathResult[0].NodeFeatures);
            Assert.IsNull(pathResult[0].EdgeFeatures);
            Assert.IsNotNull(pathResult[0].EdgeIDs);
        }
        public void FindClosestFacilityTest_ID_DatasetNULL()
        {
            //string networkDatasetName = "RoadNet@Changchun";
            int[] facilityIDs = new int[] { 1, 6, 52 };
            int eventID = 2;
            int expectFacilityCount = 2;
            bool fromEvent = false;
            double maxWeight = 0;
            TransportationAnalystParameter parameter = new TransportationAnalystParameter();
            parameter.WeightFieldName = "length";
            parameter.TurnWeightField = "TurnCost";

            NetworkAnalyst networkAnalyst = new NetworkAnalyst("http://" + ip + ":8090/iserver/services/transportationanalyst-sample/rest");
            try
            {
                List<ClosestFacilityPath<int>> pathResult = networkAnalyst.FindClosestFacility(string.Empty, facilityIDs,
                    eventID, expectFacilityCount, fromEvent, maxWeight, parameter);
            }
            catch (ArgumentException e)
            {
                Assert.AreEqual(e.Message, "参数不能为空。\r\n参数名: networkDatasetName");
            }
        }