예제 #1
0
        public void CacheInsertTest()
        {
            var productA = new ProductA("test productA", 22, 5);
            var productB = new ProductB("test productB", 30, 4000, 800);

            _sut.InsertProduct(productA);
            _sut.InsertProduct(productB);
            var items = _sut.GetAllProducts();

            Assert.Equal(2, items.Length);
        }
예제 #2
0
        public TariffComparisonResult[] GetOffersByBestCost(decimal consumption)
        {
            var allProducts = _productCache.GetAllProducts();

            return(allProducts?.Select(s => new TariffComparisonResult(s.GetName(), s.GetAnnualCost(consumption))).OrderBy(o => o.AnnualCost).ToArray());
        }