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 TestIsNotInUse() { Country country = _dataGenerator.CreateCountry(); ICountryDao countryDao = new CountryDao(_graphClient); bool isInUse = countryDao.IsInUse(country); Assert.IsFalse(isInUse); }
public void TestCreateAndReturn() { CountryDao dao = new CountryDao(_graphClient); Country newCountry = new Country() { Name = "Deutschland" }; Country created = dao.Create(newCountry); IEnumerable<Country> allCountries = dao.GetAll(); Assert.AreEqual(1, allCountries.Count()); Assert.AreEqual(created.Id, allCountries.First().Id); }
public void TestGetAll() { CountryDao dao = new CountryDao(_graphClient); Country created = _dataGenerator.CreateCountry(); IEnumerable<Country> allCountries = dao.GetAll(); Assert.AreEqual(1, allCountries.Count()); Assert.AreEqual(created.Name, allCountries.First().Name); Assert.AreEqual(created.Id, allCountries.First().Id); }
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); }
public void TestIsInUseByArea() { Country country = _dataGenerator.CreateCountry(); Area area = _dataGenerator.CreateArea(country: country); ICountryDao countryDao = new CountryDao(_graphClient); bool isInUse = countryDao.IsInUse(country); Assert.IsTrue(isInUse); }
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 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); }
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); }
public Country CreateCountry(string name = "Land") { CountryDao dao = new CountryDao(_graphClient); Country newCountry = new Country() { Name = name }; return dao.Create(newCountry); }
public void TestDeleteNotInUse() { Country country = _dataGenerator.CreateCountry(); ICountryDao countryDao = new CountryDao(_graphClient); countryDao.Delete(country); Assert.AreEqual(0, countryDao.GetAll().Count); }
public void TestUpdate() { Country country = _dataGenerator.CreateCountry(); country.Name = "newname"; ICountryDao countryDao = new CountryDao(_graphClient); countryDao.Save(country); Assert.AreEqual("newname", countryDao.GetAll().First().Name); }
public void TestDeleteInUse() { Country country = _dataGenerator.CreateCountry(); Route route = _dataGenerator.CreateRouteInCountry(country: country); ICountryDao countryDao = new CountryDao(_graphClient); Action action = ()=>countryDao.Delete(country); action.ShouldThrow<NodeInUseException>(); }
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); }
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); }