Beispiel #1
0
        public void 使用UserName作為群組依據Test()
        {
            var expected =
                new Dictionary <string, int>()
            {
                { "demo", 4 },
                { "joey", 3 },
                { "dino", 1 },
                { "bill", 1 },
                { "maduka", 1 }
            }.ToExpectedObject();

            var actual = new GroupByLab().使用UserName作為群組依據();

            expected.ShouldEqual(actual.ToDictionary(d => d.Key, d => d.Count()));
        }
Beispiel #2
0
        public void GroupByUserNameTest()
        {
            var expected =
                new Dictionary <string, int>()
            {
                { "Zoe", 4 },
                { "Demo", 3 },
                { "Stephen", 1 },
                { "Bill", 1 },
                { "Kyo", 1 }
            }.ToExpectedObject();

            var actual = new GroupByLab().GroupByUserName();

            expected.ShouldEqual(actual.ToDictionary(d => d.Key, d => d.Count()));
        }
Beispiel #3
0
        public void 使用UserName和CreateTime作為群組依據Test()
        {
            var expected =
                new List <string>()
            {
                { "demo2016-01-20" },
                { "demo2016-02-20" },
                { "demo2016-03-20" },
                { "demo2016-03-20" },
                { "joey2016-04-20" },
                { "joey2016-05-20" },
                { "joey2016-06-20" },
                { "dino2016-07-20" },
                { "bill2016-08-20" },
                { "maduka2016-01-20" },
            }.ToExpectedObject();

            var actual = new GroupByLab().使用UserName和CreateTime作為群組依據();

            expected.ShouldEqual(actual.Select(d => d.Key.UserName + "" + d.Key.CreateTime.ToString("yyyy-MM-dd")).ToList());
        }
Beispiel #4
0
        public void GroupByUserNameAndCreateTimeTest()
        {
            var expected =
                new List <string>()
            {
                { "Zoe2016-01-20" },
                { "Demo2016-02-20" },
                { "Demo2016-03-20" },
                { "Demo2016-03-20" },
                { "Zoe2016-04-20" },
                { "Zoe2016-05-20" },
                { "Zoe2016-06-20" },
                { "Stephen2016-07-20" },
                { "Bill2016-08-20" },
                { "Kyo2016-01-20" },
            }.ToExpectedObject();

            var actual = new GroupByLab().GroupByUserNameAndCreateTime();

            expected.ShouldEqual(actual.Select(d => d.Key.UserName + "" + d.Key.CreateTime.ToString("yyyy-MM-dd")).ToList());
        }
Beispiel #5
0
 public void TestInitialize()
 {
     _groupByLab = new GroupByLab(new SampleData().Data);
 }