Beispiel #1
0
        public void AggregateCostPerProduct()
        {
            using (CostPerProductAggregation aggregation = new CostPerProductAggregation())
            {
                IEnumerable <Row> result = aggregation.Execute(rows);
                List <Row>        items  = new List <Row>(result);
                Assert.Equal(3, items.Count);
                Assert.Equal("milk", items[0]["name"]);
                Assert.Equal("sugar", items[1]["name"]);
                Assert.Equal("coffee", items[2]["name"]);

                Assert.Equal(30, items[0]["cost"]);
                Assert.Equal(28, items[1]["cost"]);
                Assert.Equal(6, items[2]["cost"]);
            }
        }
        public void AggregateCostPerProduct()
        {
            using (CostPerProductAggregation aggregation = new CostPerProductAggregation())
            {
                IEnumerable<Row> result = aggregation.Execute(rows);
                List<Row> items = new List<Row>(result);
                Assert.AreEqual(3, items.Count);
                Assert.AreEqual("milk", items[0]["name"]);
                Assert.AreEqual("sugar", items[1]["name"]);
                Assert.AreEqual("coffee", items[2]["name"]);

                Assert.AreEqual(30, items[0]["cost"]);
                Assert.AreEqual(28, items[1]["cost"]);
                Assert.AreEqual(6, items[2]["cost"]);
            }
        }
        public async Task AggregateCostPerProduct()
        {
            using (CostPerProductAggregation aggregation = new CostPerProductAggregation())
            {
                IAsyncEnumerable <Row> result = aggregation.Execute(rows.ToAsyncEnumerable());
                List <Row>             items  = await result.ToListAsync();

                Assert.Equal(3, items.Count);
                Assert.Equal("milk", items[0]["name"]);
                Assert.Equal("sugar", items[1]["name"]);
                Assert.Equal("coffee", items[2]["name"]);

                Assert.Equal(30, items[0]["cost"]);
                Assert.Equal(28, items[1]["cost"]);
                Assert.Equal(6, items[2]["cost"]);
            }
        }