Beispiel #1
0
 public static bool HallDeleteValidation(int id)
 {
     try
     {
         HallController.Delete(id);
         return(true);
     }
     catch (Exception e)
     {
         return(false);
     }
 }
Beispiel #2
0
        public async Task Delete_InvalidNullAsId_RedirectToActionCreateHall()
        {
            // Arrange
            var            mockService = new Mock <IHallService>();
            HallController controller  = new HallController(mockService.Object);

            var hallCreateViewModel = new HallCreateViewModel {
                ID = null
            };

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

            // Assert
            var redirectToActionResult = Assert.IsType <RedirectToActionResult>(result);

            Assert.Equal("Hall", redirectToActionResult.ControllerName);
            Assert.Equal("Create", redirectToActionResult.ActionName);
            mockService.Verify(service => service.DeleteHall(It.IsAny <int?>()), Times.Never);
        }