public ProductsProvider(ProdutsDbContext dbContext, ILogger <ProductsProvider> logger, IMapper mapper)
        {
            this.dbContext = dbContext;
            this.logger    = logger;
            this.mapper    = mapper;

            SeedData();
        }
 private void CreateProducts(ProdutsDbContext dbContext)
 {
     for (int i = 0; i <= 10; i++)
     {
         dbContext.Add(new Product()
         {
             Id        = i + 4,
             Name      = Faker.Name.FullName(),
             Inventory = Faker.Number.RandomNumber(15, 150),
             Price     = (decimal)Faker.Number.Double()
         });
     }
     dbContext.SaveChanges();
 }
        public async Task GetProductsReturnsProductsUsingInvalidId()
        {
            var options = new DbContextOptionsBuilder <ProdutsDbContext>()
                          .UseInMemoryDatabase(nameof(GetProductsReturnsProductsUsingInvalidId))
                          .Options;
            var dbContext = new ProdutsDbContext(options);
            //CreateProducts(dbContext);

            //Mock Object for the mapper
            var productProfile = new ProductProfile();
            var configuration  = new MapperConfiguration(cfg => cfg.AddProfile(productProfile));
            var mapper         = new Mapper(configuration);

            var productsProvider = new ProductsProvider(dbContext, null, mapper);

            var product = await productsProvider.GetProductAsync(-1);

            Assert.False(product.IsSuccess);
            Assert.Null(product.Product);

            Assert.NotNull(product.ErrorMessage);
        }