public void TestCreateRouteInSummit()
        {
            Summit fakeSummit = new Summit();

            Mock<IRoutesDao> routeDaoMock = new Mock<IRoutesDao>();
            routeDaoMock.Setup(x => x.CreateIn(It.IsAny<Summit>(), It.IsAny<Route>()));

            IRouteService routeService = new RouteService(routeDaoMock.Object);
            routeService.CreateIn(fakeSummit, "Route");

            routeDaoMock.Verify(x => x.CreateIn(fakeSummit, It.Is<Route>(y => y.Name == "Route")));
        }
        public void TestCreateRouteInCountry()
        {
            Country fakeCountry = new Country();

            Mock<IRoutesDao> routeDaoMock = new Mock<IRoutesDao>();
            routeDaoMock.Setup(x => x.CreateIn(It.IsAny<Country>(), It.IsAny<Route>()));

            IRouteService routeService = new RouteService(routeDaoMock.Object);
            routeService.CreateIn(fakeCountry, "RouteInCountry");

            routeDaoMock.Verify(x => x.CreateIn(fakeCountry, It.Is<Route>(y => y.Name == "RouteInCountry")));
        }
        public void TestSave()
        {
            Mock<IRoutesDao> routesDaoMock = new Mock<IRoutesDao>();
            routesDaoMock.Setup(x => x.Save(It.IsAny<Route>()));

            Route route = new Route();

            IRouteService routeService = new RouteService(routesDaoMock.Object);
            routeService.Save(route);

            routesDaoMock.Verify(x=>x.Save(route), Times.Once);
        }
        public void TestIsInUse()
        {
            Mock<IRoutesDao> routeDaoMock = new Mock<IRoutesDao>();
            routeDaoMock.Setup(x => x.IsInUse(It.IsAny<Route>())).Returns(true);

            Route route = new Route();

            IRouteService routeService = new RouteService(routeDaoMock.Object);
            bool isInUse = routeService.IsInUse(route);
            Assert.IsTrue(isInUse);
            routeDaoMock.Verify(x=>x.IsInUse(route), Times.Once);
        }
        public void TestCreateRouteInArea()
        {
            Area fakeArea = new Area();

            Mock<IRoutesDao> routeDaoMock = new Mock<IRoutesDao>();
            routeDaoMock.Setup(x => x.CreateIn(It.IsAny<Area>(), It.IsAny<Route>()));

            IRouteService routeService = new RouteService(routeDaoMock.Object);
            routeService.CreateIn(fakeArea, "RouteInCountry");

            routeDaoMock.Verify(x => x.CreateIn(fakeArea, It.Is<Route>(y => y.Name == "RouteInCountry")));
        }
        public void TestGetRoutesInSummit()
        {
            Summit fakeSummit = new Summit();

            Mock<IRoutesDao> routeDaoMock = new Mock<IRoutesDao>();
            routeDaoMock.Setup(x => x.GetRoutesIn(It.IsAny<Summit>())).Returns(new List<Route> {new Route()});

            IRouteService routeService = new RouteService(routeDaoMock.Object);
            IList<Route> routesInCountry = routeService.GetRoutesIn(fakeSummit);

            Assert.AreEqual(routesInCountry.Count, 1);
            routeDaoMock.Verify(x => x.GetRoutesIn(fakeSummit), Times.Once);
        }
        public void TestDelete(bool isInUse)
        {
            Mock<IRoutesDao> routeDaoMock = new Mock<IRoutesDao>();
            routeDaoMock.Setup(x => x.IsInUse(It.IsAny<Route>())).Returns(isInUse);
            routeDaoMock.Setup(x => x.Delete(It.IsAny<Route>()));

            Route route = new Route();

            IRouteService routeService = new RouteService(routeDaoMock.Object);
            routeService.Delete(route);

            routeDaoMock.Verify(x=>x.Delete(route), Times.Once);
            routeDaoMock.Verify(x=>x.IsInUse(route), Times.Once);
        }