public void Test_GetNearestSegment()
        {
            var result = testCandidate.GetNearestSegment(dbGeometry);

            Assert.IsNotNull(result);
            Assert.AreEqual(result.First().Item1.LinkGeometry, lineGeometry);
            Assert.That(result.First().Item1.Id, Is.AssignableFrom(typeof(Guid)));
        }
Example #2
0
        public IActionResult GetNearestSegment([FromBody] string operationalObjectPointJson)
        {
            using (loggingHelper.RMTraceManager.StartTrace("Controller.GetNearestSegment"))
            {
                string methodName = typeof(NetworkManagerController) + "." + nameof(GetNearestSegment);
                loggingHelper.LogMethodEntry(methodName, priority, entryEventId);

                List <Tuple <NetworkLinkDTO, SqlGeometry> > result;

                result = networkManagerBusinessService.GetNearestSegment(JsonConvert.DeserializeObject <DbGeometry>(operationalObjectPointJson, new DbGeometryConverter()));

                List <Tuple <NetworkLinkDTO, DbGeometry> > convertedResult = new List <Tuple <DTO.NetworkLinkDTO, DbGeometry> >();
                foreach (var item in result)
                {
                    convertedResult.Add(new Tuple <NetworkLinkDTO, DbGeometry>(item.Item1, item.Item2.ToDbGeometry()));
                }

                loggingHelper.LogMethodExit(methodName, priority, exitEventId);
                return(Ok(convertedResult));
            }
        }