Пример #1
0
        public void Linq8_Products_ReturnsGroupedProducts()
        {
            decimal cheap = 10, middle = 30, expensive = 40;
            var     result = LinqTask.Linq8(DataSource.Products, cheap, middle, expensive).ToList();

            var cheapProducts = result.Single(_ => _.category == cheap).products;

            Assert.That(cheapProducts.Count(), Is.EqualTo(1));
            var middleProducts = result.Single(_ => _.category == middle).products;

            Assert.That(middleProducts.Count(), Is.EqualTo(3));
            var expensiveProducts = result.Single(_ => _.category == expensive).products;

            Assert.That(expensiveProducts.Count(), Is.EqualTo(1));
        }
Пример #2
0
 public void Linq8_NullProducts_ThrowsArgumentNullException()
 {
     Assert.That(() => LinqTask.Linq8(null, 42, 42, 42).ToList(), Throws.ArgumentNullException);
 }