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); }
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); }
public async Task <IActionResult> GetGeometries([FromQuery] string routes) { var result = await _routeService.GetGeometries(routes); return(WrapResponse(result)); }