Exemplo n.º 1
0
        public void SortedAggregateCostPerProduct()
        {
            using (SortedCostPerProductAggregation aggregation = new SortedCostPerProductAggregation())
            {
                IEnumerable<Row> result = aggregation.Execute(rows);
                List<Row> items = new List<Row>(result);
                Assert.Equal(4, items.Count);
                Assert.Equal("milk", items[0]["name"]);
                Assert.Equal("sugar", items[1]["name"]);
                Assert.Equal("coffee", items[2]["name"]);
                Assert.Equal("sugar", items[3]["name"]);

                Assert.Equal(30, items[0]["cost"]);
                Assert.Equal(25, items[1]["cost"]);
                Assert.Equal(6, items[2]["cost"]);
                Assert.Equal(3, items[3]["cost"]);
            }
        }
Exemplo n.º 2
0
        public void SortedAggregateCostPerProduct()
        {
            using (SortedCostPerProductAggregation aggregation = new SortedCostPerProductAggregation())
            {
                IEnumerable <Row> result = aggregation.Execute(rows);
                List <Row>        items  = new List <Row>(result);
                Assert.Equal(4, items.Count);
                Assert.Equal("milk", items[0]["name"]);
                Assert.Equal("sugar", items[1]["name"]);
                Assert.Equal("coffee", items[2]["name"]);
                Assert.Equal("sugar", items[3]["name"]);

                Assert.Equal(30, items[0]["cost"]);
                Assert.Equal(25, items[1]["cost"]);
                Assert.Equal(6, items[2]["cost"]);
                Assert.Equal(3, items[3]["cost"]);
            }
        }
Exemplo n.º 3
0
        public async Task SortedAggregateCostPerProduct()
        {
            using (SortedCostPerProductAggregation aggregation = new SortedCostPerProductAggregation())
            {
                IAsyncEnumerable <Row> result = aggregation.Execute(rows.ToAsyncEnumerable());
                List <Row>             items  = await result.ToListAsync();

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

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