Exemplo n.º 1
0
        public Summit CreateSummit(string name = "Gipfel", SummitGroup summitGroup = null)
        {
            if (summitGroup == null)
            {
                summitGroup = CreateSummitGroup();
            }
            SummitDao summitDao = new SummitDao(_graphClient);
            Summit    newSummit = new Summit()
            {
                Name = name
            };

            return(summitDao.Create(summitGroup, newSummit));
        }
Exemplo n.º 2
0
        public void TestCreateRouteInSummit()
        {
            ICountryDao countryDao = new CountryDao(_graphClient);
            Country     newCountry = new Country {
                Name = "Deutschland"
            };

            countryDao.Create(newCountry);

            IAreaDao areaDao = new AreaDao(_graphClient);
            Area     area    = new Area();

            areaDao.Create(newCountry, area);

            ISummitGroupDao summitGroupDao = new SummitGroupDao(_graphClient);
            SummitGroup     summitGroup    = new SummitGroup {
                Name = "Gipfelgruppe"
            };

            summitGroupDao.Create(area, summitGroup);

            ISummitDao summitDao = new SummitDao(_graphClient);
            Summit     summit    = new Summit {
                Name = "Gipfel"
            };

            summitDao.Create(summitGroup, summit);

            IRoutesDao routeDao = new RouteDao(_graphClient);
            Route      newRoute = new Route {
                Name = "Jakobsweg"
            };

            routeDao.CreateIn(summit, newRoute);

            IList <Route> allRoutes = _graphClient.Cypher.Match("(route:Route)")
                                      .Return(route => route.As <Route>())
                                      .Results.ToList();

            Assert.AreEqual(1, allRoutes.Count);
        }
Exemplo n.º 3
0
        public void TestGetRoutesInSummit()
        {
            ICountryDao countryDao = new CountryDao(_graphClient);
            Country     country    = new Country {
                Name = "Deutschland"
            };

            countryDao.Create(country);

            IAreaDao areaDao = new AreaDao(_graphClient);
            Area     area    = new Area();

            areaDao.Create(country, area);

            ISummitGroupDao summitGroupDao = new SummitGroupDao(_graphClient);
            SummitGroup     summitGroup    = new SummitGroup {
                Name = "Gipfelgruppe"
            };

            summitGroupDao.Create(area, summitGroup);

            ISummitDao summitDao = new SummitDao(_graphClient);
            Summit     summit    = new Summit {
                Name = "Gipfel"
            };

            summitDao.Create(summitGroup, summit);

            IRoutesDao routeDao = new RouteDao(_graphClient);
            Route      created  = routeDao.CreateIn(summit, new Route {
                Name = "Jakobsweg"
            });

            IList <Route> routesInArea = routeDao.GetRoutesIn(summit);

            Assert.AreEqual(1, routesInArea.Count);
            Assert.AreEqual("Jakobsweg", routesInArea.First().Name);
            Assert.AreEqual(created.Name, routesInArea.First().Name);
        }