public IActionResult EditRestaurant(RestoBTO restoBTO)
        {
            if (!ModelState.IsValid)
            {
                return(View(restoBTO));
            }
            restoBTO.Cuisines = restoBTO.Cuisines.Where(x => x.Selected).ToList();
            restoBTO.Pictures = pictureUC.GetAllPicturesByRestaurantId(restoBTO.Id).ToList();


            var restaurantUC = new RestaurantUC(restoRepository);
            var result       = restaurantUC.UpdateRestaurant(restoBTO);

            if (result == null)
            {
                return(RedirectToAction("Error", new { errorMessage = "We can't update this restaurant, please contact support" }));
            }
            if (User.IsInRole("Administrators"))
            {
                return(RedirectToAction("GetAllRestaurantsAdmin"));
            }
            else
            {
                return(RedirectToAction("GetRestaurantsByRestaurantManager"));
            }
        }
        public void UpdateRestaurant_Should_Return_Null_If_No_Result_Found_In_Db()
        {
            //Arrange
            var mock    = new Mock <IRestoRepository>();
            var myResto = new RestoDTO {
                City = "Bruxelles", Id = 1, Name = "R1"
            };

            mock.Setup(x => x.Update(myResto));
            RestaurantUC target = new RestaurantUC(mock.Object);

            //Act
            var result = target.UpdateRestaurant(new RestoBTO {
                City = "Bruxelles", Id = 1, Name = "R1"
            });

            //Assert
            Assert.IsNull(result);
        }
        public void UpdateRestaurant_Should_Return_Valid_Data()
        {
            //Arrange
            var mock    = new Mock <IRestoRepository>();
            var myResto = new RestoDTO {
                City = "Bruxelles", Id = 1, Name = "R1"
            };

            mock.Setup(x => x.Update(myResto)).Returns(
                new RestoDTO {
                City = "Bruxelles", Id = 1, Name = "R1"
            }
                );
            RestaurantUC target = new RestaurantUC(mock.Object);

            //Act
            var result = target.UpdateRestaurant(new RestoBTO {
                City = "Bruxelles", Id = 1, Name = "R1"
            });

            //Assert
            mock.Verify(u => u.Update(It.IsAny <RestoDTO>()), Times.Once());
        }