PageRenderTime 409ms CodeModel.GetById 211ms app.highlight 17ms RepoModel.GetById 175ms app.codeStats 0ms

/Rhino.Etl.Tests/Aggregation/AggregationFixture.cs

http://github.com/ayende/rhino-etl
C# | 60 lines | 54 code | 6 blank | 0 comment | 0 complexity | 4f42ee40d35c933cabe046aaf5703ef8 MD5 | raw file
 1namespace Rhino.Etl.Tests.Aggregation
 2{
 3    using System.Collections.Generic;
 4    using Core;
 5    using Xunit;
 6
 7    
 8    public class AggregationFixture : BaseAggregationFixture
 9    {
10        [Fact]
11        public void AggregateRowCount()
12        {
13            using (RowCount rowCount = new RowCount())
14            {
15                IEnumerable<Row> result = rowCount.Execute(rows);
16                List<Row> items = new List<Row>(result);
17                Assert.Equal(1, items.Count);
18                Assert.Equal(6, items[0]["count"]);
19            }
20        }
21
22        [Fact]
23        public void AggregateCostPerProduct()
24        {
25            using (CostPerProductAggregation aggregation = new CostPerProductAggregation())
26            {
27                IEnumerable<Row> result = aggregation.Execute(rows);
28                List<Row> items = new List<Row>(result);
29                Assert.Equal(3, items.Count);
30                Assert.Equal("milk", items[0]["name"]);
31                Assert.Equal("sugar", items[1]["name"]);
32                Assert.Equal("coffee", items[2]["name"]);
33
34                Assert.Equal(30, items[0]["cost"]);
35                Assert.Equal(28, items[1]["cost"]);
36                Assert.Equal(6, items[2]["cost"]);
37            }
38        }
39
40        [Fact]
41        public void SortedAggregateCostPerProduct()
42        {
43            using (SortedCostPerProductAggregation aggregation = new SortedCostPerProductAggregation())
44            {
45                IEnumerable<Row> result = aggregation.Execute(rows);
46                List<Row> items = new List<Row>(result);
47                Assert.Equal(4, items.Count);
48                Assert.Equal("milk", items[0]["name"]);
49                Assert.Equal("sugar", items[1]["name"]);
50                Assert.Equal("coffee", items[2]["name"]);
51                Assert.Equal("sugar", items[3]["name"]);
52
53                Assert.Equal(30, items[0]["cost"]);
54                Assert.Equal(25, items[1]["cost"]);
55                Assert.Equal(6, items[2]["cost"]);
56                Assert.Equal(3, items[3]["cost"]);
57            }
58        }
59    }
60}