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 TestDeleteInUse()
        {
            DifficultyLevel level = _dataGenerator.CreateDifficultyLevel();
            Variation variation = _dataGenerator.CreateVariation(difficultyLevel: level);

            IDifficultyLevelDao dao = new DifficultyLevelDao(_graphClient);
            Action action = ()=> dao.Delete(level);
            action.ShouldThrow<NodeInUseException>();
        }
        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);
        }
 public void TestCreateAndGetAll()
 {
     
     DifficultyLevelDao difficultyLevelDao = new DifficultyLevelDao(_graphClient);
     DifficultyLevelScale scale = _dataGenerator.CreateDifficultyLevelScale();
     DifficultyLevel created = _dataGenerator.CreateDifficultyLevel(difficultyLevelScale:scale);
     
     IList<DifficultyLevel> levelsInScale = difficultyLevelDao.GetAllIn(scale);
     Assert.AreEqual(1, levelsInScale.Count);
     Assert.AreEqual(created.Name, levelsInScale.First().Name);
     Assert.AreEqual(created.Id, levelsInScale.First().Id);
     Assert.AreEqual(created.Id, levelsInScale.First().Id);
     Assert.AreEqual(created.Score, levelsInScale.First().Score);
 }
        public void TestChangeDifficultyLevelToNewValue()
        {
            Route route = _dataGenerator.CreateRouteInCountry();
            DifficultyLevel level = _dataGenerator.CreateDifficultyLevel();
            Variation variation = _dataGenerator.CreateVariation(route: route, difficultyLevel:level);

            DifficultyLevel newLevel = _dataGenerator.CreateDifficultyLevel(name: "neues Level");

            IVariationDao variationDao = new VariationDao(_graphClient);
            variationDao.ChangeDifficultyLevel(variation, newLevel);

            IDifficultyLevelDao difficultyLevelDao = new DifficultyLevelDao(_graphClient);
            difficultyLevelDao.GetLevelOnVariation(variation).Id.Should().Be(newLevel.Id);
        }
        public void TestIsInUseWithUsedLevel()
        {
            Route route = _dataGenerator.CreateRouteInCountry();
            DifficultyLevel levelInUse = _dataGenerator.CreateDifficultyLevel();
            Variation variation = _dataGenerator.CreateVariation(levelInUse, route);

            IVariationDao variationDao = new VariationDao(_graphClient);
            IList<Variation> variationsOnRoute = variationDao.GetAllOn(route);
            Assert.AreEqual(1, variationsOnRoute.Count);
            
            IDifficultyLevelDao difficultyLevelDao = new DifficultyLevelDao(_graphClient);
            


            bool isLevelInUse = difficultyLevelDao.IsInUse(levelInUse);

            Assert.IsTrue(isLevelInUse);
        }
 public void TestDeleteNotInUse()
 {
     DifficultyLevel level = _dataGenerator.CreateDifficultyLevel();
     IDifficultyLevelDao dao = new DifficultyLevelDao(_graphClient);
     dao.Delete(level);
 }
        public void TestUpdate()
        {
            DifficultyLevelScale scale = _dataGenerator.CreateDifficultyLevelScale();
            DifficultyLevel difficultyLevel= _dataGenerator.CreateDifficultyLevel(difficultyLevelScale:scale);

            difficultyLevel.Name = "newname";

            IDifficultyLevelDao difficultyLevelDao = new DifficultyLevelDao(_graphClient);
            difficultyLevelDao.Save(difficultyLevel);

            Assert.AreEqual("newname", difficultyLevelDao.GetAllIn(scale).First().Name);
        }
        public void TestIsInUseWithUnusedLevel()
        {
            DifficultyLevel levelNotInUse = _dataGenerator.CreateDifficultyLevel();

            IDifficultyLevelDao difficultyLevelDao = new DifficultyLevelDao(_graphClient);
            bool isLevelInUse = difficultyLevelDao.IsInUse(levelNotInUse);

            Assert.IsFalse(isLevelInUse);
        }