Exemplo n.º 1
0
        public void TestIsInUseByRoute()
        {
            Country country = _dataGenerator.CreateCountry();
            Route   route   = _dataGenerator.CreateRouteInCountry(country: country);

            ICountryDao countryDao = new CountryDao(_graphClient);
            bool        isInUse    = countryDao.IsInUse(country);

            Assert.IsTrue(isInUse);
        }
Exemplo n.º 2
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");
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
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);
        }
        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);
        }