public void TestDeleteScaleNotInUse()
 {
     DifficultyLevelScale scale = _dataGenerator.CreateDifficultyLevelScale();
     IDifficultyLevelScaleDao difficultyLevelScaleDao = new DifficultyLevelScaleDao(_graphClient);
     difficultyLevelScaleDao.Delete(scale);
     Assert.AreEqual(0, difficultyLevelScaleDao.GetAll().Count);
 }
 public void TestIfScaleIsInUse()
 {
     DifficultyLevelScale scale = _dataGenerator.CreateDifficultyLevelScale();
     DifficultyLevel levelWithScale = _dataGenerator.CreateDifficultyLevel(difficultyLevelScale:scale);
     IDifficultyLevelScaleDao difficultyLevelScaleDao = new DifficultyLevelScaleDao(_graphClient);
     Assert.IsTrue(difficultyLevelScaleDao.IsInUse(scale));
 }
        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 TestDeleteScaleInUse()
 {
     DifficultyLevelScale scale = _dataGenerator.CreateDifficultyLevelScale();
     DifficultyLevel levelWithScale = _dataGenerator.CreateDifficultyLevel(difficultyLevelScale: scale);
     IDifficultyLevelScaleDao difficultyLevelScaleDao = new DifficultyLevelScaleDao(_graphClient);
     Action action = ()=>difficultyLevelScaleDao.Delete(scale);
     action.ShouldThrow<NodeInUseException>();
 }
        public void TestSave()
        {
            DifficultyLevelScale scale = _dataGenerator.CreateDifficultyLevelScale("oldname");

            scale.Name = "newname";

            IDifficultyLevelScaleDao difficultyLevelScaleDao = new DifficultyLevelScaleDao(_graphClient);
            difficultyLevelScaleDao.Save(scale);

            Assert.AreEqual("newname", difficultyLevelScaleDao.GetAll().First().Name);
        }
 public void TestCreateAndGetAll()
 {
     IDifficultyLevelScaleDao dao = new DifficultyLevelScaleDao(_graphClient);
     DifficultyLevelScale difficultyLevelScale = new DifficultyLevelScale() {Name = "sächsisch"};
     DifficultyLevelScale created = dao.Create(difficultyLevelScale);
     IList<DifficultyLevelScale> allDifficultyLevelScales = dao.GetAll();
     Assert.AreEqual(1, allDifficultyLevelScales.Count);
     Assert.AreEqual(difficultyLevelScale.Name, allDifficultyLevelScales.First().Name);
     Assert.AreEqual(difficultyLevelScale.Id, allDifficultyLevelScales.First().Id);
     Assert.AreEqual(created.Id, allDifficultyLevelScales.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);
        }
        public void TestGetForLevel()
        {
            DifficultyLevelScale scale = _dataGenerator.CreateDifficultyLevelScale();
            DifficultyLevel level = _dataGenerator.CreateDifficultyLevel(difficultyLevelScale: scale);

            IDifficultyLevelScaleDao difficultyLevelScaleDao = new DifficultyLevelScaleDao(_graphClient);
            DifficultyLevelScale scaleForLevel = difficultyLevelScaleDao.GetForDifficultyLevel(level);

            scaleForLevel.Should().NotBeNull();
            scaleForLevel.Id.Should().Be(scale.Id);
        }