public async Task TurnOffMyRestaurantOrderStatus_UserIsRestaurantOwner() { //Arrange int restaurantId = 1; string userId = "475c5e32-049c-4d7b-a963-02ebdc15a94b"; var foodRepository = new Mock <IFoodRepository>(); var restaurantRepository = new Mock <IRestaurantRepository>(); restaurantRepository.Setup(r => r.ChangeOrderAvailableStatus(restaurantId, false)) .Verifiable(); var userRepository = new Mock <IUserRepository>(); userRepository.Setup(u => u.GetMyRestaurantId(userId)) .ReturnsAsync(restaurantId); var httpContext = new Mock <IHttpContextAccessor>(); httpContext.SetupGet(h => h.HttpContext.User) .Returns(helper.GetUserClaimPrinciple(userId)); var manager = new RestaurantManager(restaurantRepository.Object, userRepository.Object, foodRepository.Object, httpContext.Object); //Act await manager.TurnOffMyRestaurantOrderOption(); //Assert restaurantRepository.Verify(); }
public async Task <ActionResult> TurnOffOrderOption() { await restaurantManager.TurnOffMyRestaurantOrderOption(); return(Ok()); }