Example #1
0
        private static async Task GetProductsTest()
        {
            IProductsService productsService = new RestApiProductsService();

            var products = await productsService.GetAsync();

            foreach (var product in products)
            {
                Console.WriteLine(product.Name);
            }
        }
Example #2
0
        private ProductsOfRestaurantController CreateFakeProductsOfRestaurantController()
        {
            //Create fake DBContext
            var context = new GlovoDbContext(ContextOptions);

            //Create RestApiRestaurantsService instance with fake DBContext
            _productsService = new RestApiProductsService(context);

            //Create mapper with UsersProfile
            var mapper = new MapperConfiguration(cfg => {
                cfg.AddProfile <LocationsProfile>();
                cfg.AddProfile <OrdersProductsProfile>();
                cfg.AddProfile <OrdersProfile>();
                cfg.AddProfile <ProductsProfile>();
                cfg.AddProfile <RestaurantsProfile>();
                cfg.AddProfile <UsersProfile>();
            }).CreateMapper();

            //Create UsersController instance with the RestApiRestaurantsService instance and the mapper
            var productsController = new ProductsOfRestaurantController(_productsService, mapper);

            return(productsController);
        }