Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
48 lines (47 loc) · 2.35 KB

File metadata and controls

48 lines (47 loc) · 2.35 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using Simple.Data.QueryPolyfills;
namespace Simple.Data.UnitTest
{
[TestFixture]
class GroupingHandlerTest
{
[Test]
public void GroupingOnSingleKeyWorks()
{
var source = new List<IDictionary<string, object>>
{
new Dictionary<string, object> {{"Id", 1}, {"Size", 1}},
new Dictionary<string, object> {{"Id", 1}, {"Size", 2}},
new Dictionary<string, object> {{"Id", 1}, {"Size", 3}},
new Dictionary<string, object> {{"Id", 2}, {"Size", 4}},
new Dictionary<string, object> {{"Id", 2}, {"Size", 5}},
new Dictionary<string, object> {{"Id", 2}, {"Size", 6}},
};
var target = new GroupingHandler("Id");
var actual = target.Group(source).ToList();
Assert.AreEqual(2, actual.Count);
}
[Test]
public void GroupingOnDoubleKeyWorks()
{
var source = new List<IDictionary<string, object>>
{
new Dictionary<string, object> {{"Id", 1}, {"Type", "A"}, {"Size", 1}},
new Dictionary<string, object> {{"Id", 1}, {"Type", "A"}, {"Size", 2}},
new Dictionary<string, object> {{"Id", 1}, {"Type", "B"}, {"Size", 3}},
new Dictionary<string, object> {{"Id", 1}, {"Type", "B"}, {"Size", 4}},
new Dictionary<string, object> {{"Id", 2}, {"Type", "A"}, {"Size", 5}},
new Dictionary<string, object> {{"Id", 2}, {"Type", "A"}, {"Size", 6}},
new Dictionary<string, object> {{"Id", 2}, {"Type", "B"}, {"Size", 7}},
new Dictionary<string, object> {{"Id", 2}, {"Type", "B"}, {"Size", 8}},
};
var target = new GroupingHandler("Id", "Type");
var actual = target.Group(source).ToList();
Assert.AreEqual(4, actual.Count);
}
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.