Ejemplo n.º 1
0
        public void GetGeometriesEmptyRoutes()
        {
            var             mocker = new RouteServiceMocker();
            RouteInfoEntity entity = new RouteInfoEntity();

            mocker.RepoMock.Setup(r => r.GetGeometries(It.IsAny <int[]>())).Callback(() => new List <RouteGeomEntity>());

            IRouteBLService service = mocker.GetService();

            var result = service.GetGeometries(string.Empty);

            Assert.Equal(ErrorStatus.ObjectNotFound, result.Result.Error.Status);
            Assert.Equal("Route not found", result.Result.Error.Message);
        }
Ejemplo n.º 2
0
        public void GetGeometriesUnhandledException()
        {
            int[] ids = new int[2] {
                32, 42
            };
            var             mocker = new RouteServiceMocker();
            RouteInfoEntity entity = new RouteInfoEntity();

            mocker.RepoMock.Setup(r => r.GetGeometries(It.IsAny <int[]>())).Throws(new Exception("testexception"));

            IRouteBLService service = mocker.GetService();

            var result = service.GetGeometries("32,42");

            Assert.Equal(ErrorStatus.InternalServer, result.Result.Error.Status);
            Assert.Equal("testexception", result.Result.Error.Message);
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> GetGeometries([FromQuery] string routes)
        {
            var result = await _routeService.GetGeometries(routes);

            return(WrapResponse(result));
        }