Пример #1
0
        public async Task GetUserFavouriteRestaurantList()
        {
            //Arrange
            string userId = "475c5e32-049c-4d7b-a963-02ebdc15a94b";
            var    expectedRestaurantOverviewPagedList = helper.GetRestaurantOverviewPagedList();

            var userRepository       = new Mock <IUserRepository>();
            var foodRepository       = new Mock <IFoodRepository>();
            var restaurantRepository = new Mock <IRestaurantRepository>();

            restaurantRepository.Setup(r => r.GetGuestFavouriteRestaurantList(userId, It.IsAny <RestaurantSearchDto>()))
            .ReturnsAsync(expectedRestaurantOverviewPagedList);
            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
            var restaurantOverviewPagedList = await manager.GetGuestFavouriteRestaurantList(new RestaurantSearchDto());

            //Assert
            Assert.Equal(expectedRestaurantOverviewPagedList, restaurantOverviewPagedList);
        }
Пример #2
0
 public async Task <PagedListDto <RestaurantOverviewDto> > GetGuestFavouriteRestaurantList([FromQuery] RestaurantSearchDto search)
 {
     return(await restaurantManager.GetGuestFavouriteRestaurantList(search));
 }