public string Code { get; }
public decimal Price { get; }
public decimal? Discount { get; }
public Product(string code, decimal price, decimal? discount)
public interface IProductRepository
IList<Product> GetAllProducts();
public class ProductRepository : IProductRepository
public IList<Product> GetAllProducts()
throw new System.NotImplementedException();
public class ProductCatalog
private readonly IProductRepository _productRepository;
public ProductCatalog(IProductRepository productRepository)
_productRepository = productRepository;
public IList<Product> FindProductsWithDiscountMoreThan(decimal threshold)
return _productRepository
.Where(x => x.Price * x.Discount >= threshold).ToList();