-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathTaskSeq.OfXXX.Tests.fs
More file actions
57 lines (45 loc) · 1.46 KB
/
TaskSeq.OfXXX.Tests.fs
File metadata and controls
57 lines (45 loc) · 1.46 KB
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
49
50
51
52
53
54
55
56
57
module FSharpy.TaskSeq.Tests.``Conversion-From``
open Xunit
open FsUnit.Xunit
open FsToolkit.ErrorHandling
open FSharpy
let validateSequence sq = task {
let! sq = TaskSeq.toArrayAsync sq
do sq |> Seq.toArray |> should equal [| 0..9 |]
}
[<Fact>]
let ``TaskSeq-ofAsyncArray should succeed`` () =
Array.init 10 (fun x -> async { return x })
|> TaskSeq.ofAsyncArray
|> validateSequence
[<Fact>]
let ``TaskSeq-ofAsyncList should succeed`` () =
List.init 10 (fun x -> async { return x })
|> TaskSeq.ofAsyncList
|> validateSequence
[<Fact>]
let ``TaskSeq-ofAsyncSeq should succeed`` () =
Seq.init 10 (fun x -> async { return x })
|> TaskSeq.ofAsyncSeq
|> validateSequence
[<Fact>]
let ``TaskSeq-ofTaskArray should succeed`` () =
Array.init 10 (fun x -> task { return x })
|> TaskSeq.ofTaskArray
|> validateSequence
[<Fact>]
let ``TaskSeq-ofTaskList should succeed`` () =
List.init 10 (fun x -> task { return x })
|> TaskSeq.ofTaskList
|> validateSequence
[<Fact>]
let ``TaskSeq-ofTaskSeq should succeed`` () =
Seq.init 10 (fun x -> task { return x })
|> TaskSeq.ofTaskSeq
|> validateSequence
[<Fact>]
let ``TaskSeq-ofArray should succeed`` () = Array.init 10 id |> TaskSeq.ofArray |> validateSequence
[<Fact>]
let ``TaskSeq-ofList should succeed`` () = List.init 10 id |> TaskSeq.ofList |> validateSequence
[<Fact>]
let ``TaskSeq-ofSeq should succeed`` () = Seq.init 10 id |> TaskSeq.ofSeq |> validateSequence