Exemplo n.º 1
0
        public void TestIsNotInUse()
        {
            SummitGroup summitGroup = _dataGenerator.CreateSummitGroup();

            ISummitGroupDao summitGroupDao = new SummitGroupDao(_graphClient);
            bool isInUse = summitGroupDao.IsInUse(summitGroup);

            Assert.IsFalse(isInUse);
        }
 public SummitGroup CreateSummitGroup(string name = "Gipfelgruppe", Area area = null)
 {
     if (area == null)
     {
         area = CreateArea();
     }
     SummitGroupDao summitGroupDao = new SummitGroupDao(_graphClient);
     SummitGroup newSummitGroup = new SummitGroup() { Name = name };
     return summitGroupDao.Create(area, newSummitGroup);
 }
Exemplo n.º 3
0
        public void TestIsInUseByRoute()
        {
            SummitGroup summitGroup = _dataGenerator.CreateSummitGroup();
            Route route = _dataGenerator.CreateRouteInSummitGroup(summitGroup: summitGroup);

            ISummitGroupDao summitGroupDao = new SummitGroupDao(_graphClient);
            bool isInUse = summitGroupDao.IsInUse(summitGroup);

            Assert.IsTrue(isInUse);
        }
Exemplo n.º 4
0
        public void TestCreateAndGetAll()
        {
            Area area = _dataGenerator.CreateArea();
            SummitGroupDao groupDao = new SummitGroupDao(_graphClient);
            SummitGroup created = _dataGenerator.CreateSummitGroup(area: area);

            IList<SummitGroup> groupsInArea = groupDao.GetAllIn(area);
            Assert.AreEqual(1, groupsInArea.Count);
            Assert.AreEqual(created.Name, groupsInArea.First().Name);
            Assert.AreEqual(created.Id, groupsInArea.First().Id);
            Assert.AreEqual(created.Id, groupsInArea.First().Id);
        }
Exemplo n.º 5
0
        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);
        }
Exemplo n.º 6
0
        public void TestDeleteNotInUse()
        {
            Area area = _dataGenerator.CreateArea();
            SummitGroup summitGroup = _dataGenerator.CreateSummitGroup(area:area);

            ISummitGroupDao summitGroupDao = new SummitGroupDao(_graphClient);
            summitGroupDao.Delete(summitGroup);

            Assert.AreEqual(0, summitGroupDao.GetAllIn(area).Count);
        }
Exemplo n.º 7
0
        public void TestDeleteInUse()
        {
            SummitGroup summitGroup = _dataGenerator.CreateSummitGroup();
            Route route = _dataGenerator.CreateRouteInSummitGroup(summitGroup: summitGroup);

            ISummitGroupDao summitGroupDao = new SummitGroupDao(_graphClient);
            Action action = ()=> summitGroupDao.Delete(summitGroup);
            action.ShouldThrow<NodeInUseException>();
        }
Exemplo n.º 8
0
        public void TestUpdate()
        {
            Area area = _dataGenerator.CreateArea();
            SummitGroup summitGroup = _dataGenerator.CreateSummitGroup("oldname", area);

            summitGroup.Name = "newname";

            ISummitGroupDao summitGroupDao = new SummitGroupDao(_graphClient);
            summitGroupDao.Save(summitGroup);

            Assert.AreEqual("newname", summitGroupDao.GetAllIn(area).First().Name);
        }
Exemplo n.º 9
0
        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);
        }