-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathTaskSeq.Indexed.Tests.fs
More file actions
37 lines (30 loc) · 928 Bytes
/
TaskSeq.Indexed.Tests.fs
File metadata and controls
37 lines (30 loc) · 928 Bytes
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
module TaskSeq.Tests.Indexed
open Xunit
open FsUnit.Xunit
open FsToolkit.ErrorHandling
open FSharp.Control
//
// TaskSeq.indexed
//
module EmptySeq =
[<Fact>]
let ``Null source is invalid`` () = assertNullArg <| fun () -> TaskSeq.indexed null
[<Theory; ClassData(typeof<TestEmptyVariants>)>]
let ``TaskSeq-indexed on empty`` variant =
Gen.getEmptyVariant variant
|> TaskSeq.indexed
|> verifyEmpty
module Immutable =
[<Fact>]
let ``TaskSeq-indexed starts at zero`` () =
taskSeq { yield 99 }
|> TaskSeq.indexed
|> TaskSeq.head
|> Task.map (should equal (0, 99))
[<Theory; ClassData(typeof<TestImmTaskSeq>)>]
let ``TaskSeq-indexed`` variant =
Gen.getSeqImmutable variant
|> TaskSeq.indexed
|> TaskSeq.toArrayAsync
|> Task.map (Array.forall (fun (x, y) -> x + 1 = y))
|> Task.map (should be True)