-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathQueryRunnerTests.fs
48 lines (35 loc) · 1.42 KB
/
QueryRunnerTests.fs
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
module QueryTests
open NUnit.Framework
open Swensen.Unquote
open QueryRunner
open System.Threading
let slowExecutor input =
Thread.Sleep(100)
Set[input]
[<Test>]
let ``simple query`` () =
let query = SimpleQuery("obligation1")
let result = runQuery slowExecutor query
result =? Set["obligation1"]
[<Test>]
let ``complex query with OR aggregate`` () =
let simpleQuery1 = SimpleQuery("obligation1")
let simpleQuery2 = SimpleQuery("obligation2")
let complexQuery = ComplexQuery(AggregateFunction.Union,[simpleQuery1;simpleQuery2])
let result = runQuery slowExecutor complexQuery
result =? Set["obligation1";"obligation2"]
[<Test>]
let ``complex query with AND aggregate`` () =
let simpleQuery1 = SimpleQuery("obligation1")
let simpleQuery2 = SimpleQuery("obligation2")
let complexQuery = ComplexQuery(AggregateFunction.Intersect,[simpleQuery1;simpleQuery2])
let result = runQuery slowExecutor complexQuery
result =? Set[]
[<Test>]
let ``complex query with Intersect and Union aggregate`` () =
let simpleQuery1 = SimpleQuery("obligation1")
let simpleQuery2 = SimpleQuery("obligation2")
let complexQuery = ComplexQuery(AggregateFunction.Union,[simpleQuery1; simpleQuery1; simpleQuery2 ])
let finalQuery = ComplexQuery(AggregateFunction.Intersect,[simpleQuery1;complexQuery])
let result = runQuery slowExecutor finalQuery
result =? Set["obligation1"]