public void DeleteRouteRouteNotExists()
 {
     try
     {
         _routesController.Delete(new DeleteRouteRequest
         {
             PointFromCode = _routeBase.PointFromCode,
             PointToCode   = _routeBase.PointToCode
         });
     }
     catch (ResponseException) { }
 }
Ejemplo n.º 2
0
        public void DeleteTest()
        {
            var controller = new RoutesController();
            var result     = controller.Delete(1) as ViewResult;
            var route      = result.Model as Route;

            Assert.IsTrue(route.RouteName == "Route - 1");
        }
Ejemplo n.º 3
0
        public void TestPostDeleteRouteNotExsist()
        {
            // Arrange
            var controller = new RoutesController(new RouteLogic(new RouteRepositoryStub()), new StationLogic(new StationRepositoryStub()));

            // ACt
            var result = controller.Delete(100) as HttpNotFoundResult;

            // Assert
            Assert.AreEqual(404, result.StatusCode);
        }
Ejemplo n.º 4
0
        public void TestPostDelete()
        {
            // Arrange
            var controller = new RoutesController(new RouteLogic(new RouteRepositoryStub()), new StationLogic(new StationRepositoryStub()));

            // ACt
            var result = (ViewResult)controller.Delete(1);

            // Assert
            Assert.AreEqual("", result.ViewName);
        }
Ejemplo n.º 5
0
        public async Task DeleteGet_ReturnsANotFoundResult_WhenIdIsNull()
        {
            // Arrange
            var mockRoutesRepo = new Mock <IRoutesRepository>();
            var mockPointsRepo = new Mock <IPointsRepository>();
            var controller     = new RoutesController(mockRoutesRepo.Object, mockPointsRepo.Object);

            // Act
            var result = await controller.Delete(null);

            // Assert
            Assert.IsType <NotFoundResult>(result);
        }
Ejemplo n.º 6
0
        public async Task DeleteGet_ReturnsANotFoundResult_WhenRouteReturnedIsNull()
        {
            // Arrange
            var mockRoutesRepo = new Mock <IRoutesRepository>();

            mockRoutesRepo.Setup(repo => repo.GetRouteByID(1)).Returns(Task.FromResult((Route)null));
            var mockPointsRepo = new Mock <IPointsRepository>();
            var controller     = new RoutesController(mockRoutesRepo.Object, mockPointsRepo.Object);

            // Act
            var result = await controller.Delete(1);

            // Assert
            Assert.IsType <NotFoundResult>(result);
        }
Ejemplo n.º 7
0
        public async Task DeleteGet_ReturnsAViewResult_WithRoute()
        {
            // Arrange
            var mockRoutesRepo = new Mock <IRoutesRepository>();

            mockRoutesRepo.Setup(repo => repo.GetRouteByID(1)).Returns(Task.FromResult(GetTestRoutes()[0]));
            var mockPointsRepo = new Mock <IPointsRepository>();
            var controller     = new RoutesController(mockRoutesRepo.Object, mockPointsRepo.Object);

            // Act
            var result = await controller.Delete(1);

            // Assert
            var viewResult = Assert.IsType <ViewResult>(result);
            var model      = Assert.IsAssignableFrom <Route>(viewResult.ViewData.Model);

            Assert.Equal(GetTestRoutes()[0], model);
        }