コード例 #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);
        }
コード例 #2
0
        public void TestDeleteNormal()
        {

            Route route = _dataGenerator.CreateRouteInCountry();
            Variation variation = _dataGenerator.CreateVariation(route: route);

            IVariationDao variationDao = new VariationDao(_graphClient);
            ILogEntryDao logEntryDao = new LogEntryDao(_graphClient);
            LogEntry created = _dataGenerator.CreateLogEntry(variation);

            LogEntry logEntry = logEntryDao.GetAllIn(variation).First();

            /* Wenn ein Logeintrag einer Variation gelöscht wird */
            logEntryDao.Delete(logEntry);

            /* Muss der Logeintrag verschwunden, aber die Variation noch vorhanden sein */
            Assert.AreEqual(0, logEntryDao.GetAllIn(variation).Count);
            Assert.AreEqual(1, variationDao.GetAllOn(route).Count);
        }
コード例 #3
0
 public void TestDeleteNormal()
 {
     Route route = _dataGenerator.CreateRouteInArea();
     Variation variationWithoutLogEntries = _dataGenerator.CreateVariation(route:route);
     IVariationDao variationDao = new VariationDao(_graphClient);
     variationDao.Delete(variationWithoutLogEntries);
     Assert.AreEqual(0, variationDao.GetAllOn(route).Count);
 }
コード例 #4
0
        public void TestSave()
        {
            Route route = _dataGenerator.CreateRouteInCountry();
            Variation variation = _dataGenerator.CreateVariation(route:route);

            variation.Name.Should().NotBe("newname");

            variation.Name = "newname";

            IVariationDao variationDao = new VariationDao(_graphClient);
            variationDao.Save(variation);

            variationDao.GetAllOn(route).First().Name.Should().Be("newname");
        }
コード例 #5
0
        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);
        }