Exemplo n.º 1
0
        public void Linq8_Products_ReturnsGroupedProducts()
        {
            decimal cheap = 10, middle = 30, expensive = 40;
            var     result = SelectExtensions.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));
        }
Exemplo n.º 2
0
 public void Linq8_NullProducts_ThrowsArgumentNullException()
 {
     Assert.That(() => SelectExtensions.Linq8(null, 42, 42, 42).ToList(), Throws.ArgumentNullException);
 }