예제 #1
0
        public void TestCreateAndGetAll()
        {
            ICountryDao countryDao = new CountryDao(_graphClient);
            Country country = new Country() {Name = "D"};
            countryDao.Create(country);

            IRoutesDao routeDao = new RouteDao(_graphClient);
            Route route = new Route() {Name = "Route1"};
            routeDao.CreateIn(country, route);

            IDifficultyLevelScaleDao scaleDao = new DifficultyLevelScaleDao(_graphClient);
            DifficultyLevelScale scale = new DifficultyLevelScale() {Name = "sächsisch"};
            scaleDao.Create(scale);

            IDifficultyLevelDao levelDao = new DifficultyLevelDao(_graphClient);
            DifficultyLevel level = new DifficultyLevel() {Name = "7b"};
            levelDao.Create(scale, level);

            IVariationDao variationDao = new VariationDao(_graphClient);
            Variation variation = new Variation() {Name = "Ein Weg der Route1 als 7b"};
            Variation created = variationDao.Create(variation, route, level);

            IList<Variation> variationsOnRoute = variationDao.GetAllOn(route);
            Assert.AreEqual(1, variationsOnRoute.Count);
            Assert.AreEqual(variation.Name, variationsOnRoute.First().Name);
            Assert.AreEqual(variation.Id, variationsOnRoute.First().Id);
            Assert.AreEqual(created.Id, variationsOnRoute.First().Id);
        }
        public void TestGetLevelOnVariation()
        {
            Country country = new CountryDao(_graphClient).Create(new Country() {Name = "var test"});
            Route route = new RouteDao(_graphClient).CreateIn(country,new Route() {Name = "r var test"});
            DifficultyLevelScale scale = new DifficultyLevelScaleDao(_graphClient).Create(new DifficultyLevelScale());
            DifficultyLevel level = new DifficultyLevelDao(_graphClient).Create(scale, new DifficultyLevel() {Name = "dl var test"});
            Variation variation = new VariationDao(_graphClient).Create(new Variation() {Name = "v var test"}, route,level);
            
            Variation variationOnRoute = new VariationDao(_graphClient).GetAllOn(route).First();

            DifficultyLevel levelOnVariation = new DifficultyLevelDao(_graphClient).GetLevelOnVariation(variationOnRoute);

            Assert.AreEqual(level.Id, levelOnVariation.Id);
        }
예제 #3
0
        public void TestGetRoutesInCountry()
        {
            ICountryDao countryDao = new CountryDao(_graphClient);
            Country country = new Country {Name = "Deutschland"};
            countryDao.Create(country);

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

            IList<Route> routesInCountry = routeDao.GetRoutesIn(country);
            Assert.AreEqual(1, routesInCountry.Count);
            Assert.AreEqual("Jakobsweg", routesInCountry.First().Name);
            Assert.AreEqual(created.Name, routesInCountry.First().Name);
        }
예제 #4
0
        public void TestGetRoutesInSummitGroup()
        {
            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);

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

            IList<Route> routesInArea = routeDao.GetRoutesIn(summitGroup);
            Assert.AreEqual(1, routesInArea.Count);
            Assert.AreEqual("Jakobsweg", routesInArea.First().Name);
            Assert.AreEqual(created.Name, routesInArea.First().Name);
        }
예제 #5
0
        public void TestDeleteRouteInUse()
        {
            Route route = _dataGenerator.CreateRouteInArea();
            Variation variation = _dataGenerator.CreateVariation(route: route);

            IRoutesDao routesDao = new RouteDao(_graphClient);
            Action action = ()=> routesDao.Delete(route);
            action.ShouldThrow<NodeInUseException>();
        }
예제 #6
0
        public void TestSave()
        {
            Country country = _dataGenerator.CreateCountry();
            Route route = _dataGenerator.CreateRouteInCountry("oldname", country);

            IRoutesDao routesDao = new RouteDao(_graphClient);
            Assert.AreEqual(1, routesDao.GetRoutesIn(country).Count);

            route.Name = "newname";
            routesDao.Save(route);

            Assert.AreEqual("newname",  routesDao.GetRoutesIn(country).First().Name);
        }
예제 #7
0
        public void TestDeleteRouteNotInUse()
        {
            Area area = _dataGenerator.CreateArea();
            Route route = _dataGenerator.CreateRouteInArea(area:area);

            IRoutesDao routesDao = new RouteDao(_graphClient);
            routesDao.Delete(route);

            Assert.AreEqual(0, routesDao.GetRoutesIn(area).Count);
        }
예제 #8
0
        public void TestRouteIsNotInUse()
        {
            Route route = _dataGenerator.CreateRouteInArea();

            IRoutesDao routesDao = new RouteDao(_graphClient);
            bool isInUse = routesDao.IsInUse(route);

            Assert.IsFalse(isInUse);
        }
예제 #9
0
        public void TestRouteIsInUse()
        {
            Route route = _dataGenerator.CreateRouteInArea();
            Variation variation = _dataGenerator.CreateVariation(route: route);

            IRoutesDao routesDao = new RouteDao(_graphClient);
            bool isInUse = routesDao.IsInUse(route);

            Assert.IsTrue(isInUse);
        }
예제 #10
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);
        }
예제 #11
0
        public void TestCreateRouteInArea()
        {
            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);

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

            IList<Route> allRoutes = _graphClient.Cypher.Match("(route:Route)")
                .Return(route => route.As<Route>())
                .Results.ToList();
            Assert.AreEqual(1, allRoutes.Count);
        }