public void GetAll() { PointsBusiness pointsBiz = new PointsBusiness(new UnitOfWork()); // Arrange var result = pointsBiz.GetAll(); // Assert Assert.IsNotNull(result); Assert.IsInstanceOfType(result, typeof(List <Point>)); }
public IHttpActionResult SearchRoutes(int originPointId, int destinationPointId) { var searchEngine = new SearchEngine(RouteSearcherType.DFS); searchEngine.LoadAllPoints(_pointsBiz.GetAll()); var routeList = searchEngine.SearchRoutes(originPointId, destinationPointId); var result = routeList.Select( x => x.Select(y => RouteDTO.ToDTO(y)) ); return(Ok(result)); }
public void RouteSearchTest() { PointsBusiness pointsBiz = new PointsBusiness(new UnitOfWork()); SearchEngine searchEngine = new SearchEngine(RouteSearcherType.DFS); searchEngine.LoadAllPoints(pointsBiz.GetAll()); var routeListUsingIds = searchEngine.SearchRoutes(1, 6); var routeListUsingObjects = searchEngine.SearchRoutes(pointsBiz.GetById(1), pointsBiz.GetById(6)); // Assert Assert.IsNotNull(routeListUsingIds); Assert.IsNotNull(routeListUsingObjects); Assert.AreEqual(routeListUsingObjects.Count, routeListUsingIds.Count); }
public ActionResult Index() { ViewBag.Title = "Home Page"; PointsBusiness pointsBiz = new PointsBusiness(new Data.UnitOfWork()); var allPoints = pointsBiz.GetAll(); var searchEngine = new SearchEngine(RouteSearcherType.DFS); searchEngine.LoadAllPoints(allPoints); var routes = searchEngine.SearchRoutes(allPoints[0], allPoints[5]); return(View()); }
public void RouteSearchWithMinmumIntermediateTest() { PointsBusiness pointsBiz = new PointsBusiness(new UnitOfWork()); SearchEngine searchEngine = new SearchEngine(RouteSearcherType.DFS); var minimumIntermediatePoints = 1; searchEngine.SetMinimumIntermediatePoints(minimumIntermediatePoints); searchEngine.LoadAllPoints(pointsBiz.GetAll()); var routeList = searchEngine.SearchRoutes(3, 6); // Assert Assert.IsNotNull(routeList); Assert.IsTrue(searchEngine.GetMinimumIntermediatePoints() == minimumIntermediatePoints); Assert.IsTrue(routeList.Count > minimumIntermediatePoints); }
public void RouteSearchExceptionOriginNotFound() { try { PointsBusiness pointsBiz = new PointsBusiness(new UnitOfWork()); SearchEngine searchEngine = new SearchEngine(RouteSearcherType.DFS); var minimumIntermediatePoints = 1; searchEngine.SetMinimumIntermediatePoints(minimumIntermediatePoints); searchEngine.LoadAllPoints(pointsBiz.GetAll()); var routeList = searchEngine.SearchRoutes(9, 6); } catch (Exception ex) { // not the right kind of exception Assert.IsTrue(ex.Message == "Origin point not found"); } }