7
7
8
8
using System . Linq ;
9
9
using System . Threading ;
10
+ using System . Threading . Tasks ;
10
11
using Akka . Streams . Dsl ;
11
12
using Akka . Streams . TestKit ;
12
13
using Akka . TestKit ;
@@ -27,76 +28,70 @@ public GraphWireTapSpec(ITestOutputHelper helper)
27
28
}
28
29
29
30
[ Fact ]
30
- public void A_WireTap_must_broadcast_to_the_tap ( )
31
+ public async Task A_WireTap_must_broadcast_to_the_tap ( )
31
32
{
32
- this . AssertAllStagesStopped ( ( ) =>
33
- {
34
- var ( tps , mps ) = Source . From ( Enumerable . Range ( 1 , 2 ) )
35
- . WireTapMaterialized ( this . SinkProbe < int > ( ) , Keep . Right )
36
- . ToMaterialized ( this . SinkProbe < int > ( ) , Keep . Both )
37
- . Run ( Materializer ) ;
33
+ await this . AssertAllStagesStoppedAsync ( async ( ) => {
34
+ var ( tps , mps ) = Source . From ( Enumerable . Range ( 1 , 2 ) )
35
+ . WireTapMaterialized ( this . SinkProbe < int > ( ) , Keep . Right )
36
+ . ToMaterialized ( this . SinkProbe < int > ( ) , Keep . Both )
37
+ . Run ( Materializer ) ;
38
38
39
39
tps . Request ( 2 ) ;
40
- mps . RequestNext ( 1 ) ;
41
- mps . RequestNext ( 2 ) ;
42
- tps . ExpectNext ( 1 , 2 ) ;
43
- mps . ExpectComplete ( ) ;
44
- tps . ExpectComplete ( ) ;
40
+ await mps . RequestNextAsync ( 1 ) ;
41
+ await mps . RequestNextAsync ( 2 ) ;
42
+ tps . ExpectNext ( 1 , 2 ) ;
43
+ await mps . ExpectCompleteAsync ( ) ;
44
+ await tps . ExpectCompleteAsync ( ) ;
45
45
} , Materializer ) ;
46
46
}
47
47
48
48
[ Fact ]
49
- public void A_WireTap_must_drop_elements_while_the_tap_has_no_demand_buffering_up_to_one_element ( )
49
+ public async Task A_WireTap_must_drop_elements_while_the_tap_has_no_demand_buffering_up_to_one_element ( )
50
50
{
51
- this . AssertAllStagesStopped ( ( ) =>
52
- {
53
- var ( tps , mps ) = Source . From ( Enumerable . Range ( 1 , 6 ) )
54
- . WireTapMaterialized ( this . SinkProbe < int > ( ) , Keep . Right )
55
- . ToMaterialized ( this . SinkProbe < int > ( ) , Keep . Both )
56
- . Run ( Materializer ) ;
57
-
51
+ await this . AssertAllStagesStoppedAsync ( async ( ) => {
52
+ var ( tps , mps ) = Source . From ( Enumerable . Range ( 1 , 6 ) )
53
+ . WireTapMaterialized ( this . SinkProbe < int > ( ) , Keep . Right )
54
+ . ToMaterialized ( this . SinkProbe < int > ( ) , Keep . Both )
55
+ . Run ( Materializer ) ;
58
56
mps . Request ( 3 ) ;
59
- mps . ExpectNext ( 1 , 2 , 3 ) ;
57
+ mps . ExpectNext ( 1 , 2 , 3 ) ;
60
58
tps . Request ( 4 ) ;
61
- mps . RequestNext ( 4 ) ;
62
- mps . RequestNext ( 5 ) ;
63
- mps . RequestNext ( 6 ) ;
64
- tps . ExpectNext ( 3 , 4 , 5 , 6 ) ;
65
- mps . ExpectComplete ( ) ;
66
- tps . ExpectComplete ( ) ;
59
+ await mps . RequestNextAsync ( 4 ) ;
60
+ await mps . RequestNextAsync ( 5 ) ;
61
+ await mps . RequestNextAsync ( 6 ) ;
62
+ tps . ExpectNext ( 3 , 4 , 5 , 6 ) ;
63
+ await mps . ExpectCompleteAsync ( ) ;
64
+ await tps . ExpectCompleteAsync ( ) ;
67
65
} , Materializer ) ;
68
66
}
69
67
70
68
[ Fact ]
71
- public void A_WireTap_must_cancel_if_main_sink_cancels ( )
69
+ public async Task A_WireTap_must_cancel_if_main_sink_cancels ( )
72
70
{
73
- this . AssertAllStagesStopped ( ( ) =>
74
- {
75
- var ( tps , mps ) = Source . From ( Enumerable . Range ( 1 , 6 ) )
76
- . WireTapMaterialized ( this . SinkProbe < int > ( ) , Keep . Right )
77
- . ToMaterialized ( this . SinkProbe < int > ( ) , Keep . Both )
78
- . Run ( Materializer ) ;
79
-
71
+ await this . AssertAllStagesStoppedAsync ( async ( ) => {
72
+ var ( tps , mps ) = Source . From ( Enumerable . Range ( 1 , 6 ) )
73
+ . WireTapMaterialized ( this . SinkProbe < int > ( ) , Keep . Right )
74
+ . ToMaterialized ( this . SinkProbe < int > ( ) , Keep . Both )
75
+ . Run ( Materializer ) ;
76
+
80
77
tps . Request ( 6 ) ;
81
78
mps . Cancel ( ) ;
82
- tps . ExpectComplete ( ) ;
79
+ await tps . ExpectCompleteAsync ( ) ;
83
80
} , Materializer ) ;
84
81
}
85
82
86
83
[ Fact ]
87
- public void A_WireTap_must_continue_if_tap_sink_cancels ( )
84
+ public async Task A_WireTap_must_continue_if_tap_sink_cancels ( )
88
85
{
89
- this . AssertAllStagesStopped ( ( ) =>
90
- {
91
- var ( tps , mps ) = Source . From ( Enumerable . Range ( 1 , 6 ) )
92
- . WireTapMaterialized ( this . SinkProbe < int > ( ) , Keep . Right )
93
- . ToMaterialized ( this . SinkProbe < int > ( ) , Keep . Both )
94
- . Run ( Materializer ) ;
95
-
86
+ await this . AssertAllStagesStoppedAsync ( async ( ) => {
87
+ var ( tps , mps ) = Source . From ( Enumerable . Range ( 1 , 6 ) )
88
+ . WireTapMaterialized ( this . SinkProbe < int > ( ) , Keep . Right )
89
+ . ToMaterialized ( this . SinkProbe < int > ( ) , Keep . Both )
90
+ . Run ( Materializer ) ;
96
91
tps . Cancel ( ) ;
97
92
mps . Request ( 6 ) ;
98
- mps . ExpectNext ( 1 , 2 , 3 , 4 , 5 , 6 ) ;
99
- mps . ExpectComplete ( ) ;
93
+ mps . ExpectNext ( 1 , 2 , 3 , 4 , 5 , 6 ) ;
94
+ await mps . ExpectCompleteAsync ( ) ;
100
95
} , Materializer ) ;
101
96
}
102
97
}
0 commit comments