public async Task GetAllProducts_ReturnsDataAsync()
        {
            // Arrange
            var productList = new List <Product>()
            {
                new Product()
                {
                    Id = Guid.NewGuid(), Code = "123"
                },
                new Product()
                {
                    Id = Guid.NewGuid(), Code = "234"
                }
            };

            var httpClient = new TestHelper().CreateMockHttpClient(JsonConvert.SerializeObject(productList), HttpStatusCode.OK);

            var service = new ProductCatalogService(httpClient);

            // Act
            var result = await service.GetAllProducts();

            // Assert
            Assert.Equal(productList.Count(), result.Count());
        }
        public async Task Consume(ConsumeContext <IGetAllProductsCommand> context)
        {
            try
            {
                var connectionStringSettings = new ConnectionStringSettings();
                _configurationRoot.GetSection("ConnectionStrings").Bind(connectionStringSettings);
                var dbContext  = ProductDbContext.GetProductDbContext(connectionStringSettings.DefaultConnection);
                var repository = new RepositoryWrapper(dbContext);

                var productService = new ProductCatalogService(repository);
                var result         = await productService.GetAllProducts(context.Message);

                var getProductEvent = new AllProductRetrievedEvent(result);
                await context.RespondAsync(getProductEvent);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }