1
1
using System . Net ;
2
2
using System . Net . Http ;
3
+ using System . Threading ;
3
4
using System . Threading . Tasks ;
4
5
using MbDotNet . Exceptions ;
5
6
using MbDotNet . Models . Imposters ;
@@ -29,12 +30,12 @@ public async Task DeleteAllImposters_SendsRequest()
29
30
30
31
var response = GetResponse ( HttpStatusCode . OK ) ;
31
32
32
- _mockClient . Setup ( x => x . DeleteAsync ( expectedResource ) )
33
+ _mockClient . Setup ( x => x . DeleteAsync ( expectedResource , default ) )
33
34
. ReturnsAsync ( response ) ;
34
35
35
36
await _proxy . DeleteAllImpostersAsync ( ) . ConfigureAwait ( false ) ;
36
37
37
- _mockClient . Verify ( x => x . DeleteAsync ( expectedResource ) , Times . Once ) ;
38
+ _mockClient . Verify ( x => x . DeleteAsync ( expectedResource , default ) , Times . Once ) ;
38
39
}
39
40
40
41
[ TestMethod ]
@@ -43,7 +44,7 @@ public async Task DeleteAllImposters_StatusCodeNotOk_ThrowsMountebankException()
43
44
{
44
45
var response = GetResponse ( HttpStatusCode . BadRequest ) ;
45
46
46
- _mockClient . Setup ( x => x . DeleteAsync ( It . IsAny < string > ( ) ) )
47
+ _mockClient . Setup ( x => x . DeleteAsync ( It . IsAny < string > ( ) , default ) )
47
48
. ReturnsAsync ( response ) ;
48
49
49
50
await _proxy . DeleteAllImpostersAsync ( ) . ConfigureAwait ( false ) ;
@@ -57,12 +58,12 @@ public async Task DeleteImposter_SendsRequest_ImpostersResourceWithPort()
57
58
58
59
var response = GetResponse ( HttpStatusCode . OK ) ;
59
60
60
- _mockClient . Setup ( x => x . DeleteAsync ( expectedResource ) )
61
+ _mockClient . Setup ( x => x . DeleteAsync ( expectedResource , default ) )
61
62
. ReturnsAsync ( response ) ;
62
63
63
64
await _proxy . DeleteImposterAsync ( port ) . ConfigureAwait ( false ) ;
64
65
65
- _mockClient . Verify ( x => x . DeleteAsync ( expectedResource ) , Times . Once ) ;
66
+ _mockClient . Verify ( x => x . DeleteAsync ( expectedResource , default ) , Times . Once ) ;
66
67
}
67
68
68
69
[ TestMethod ]
@@ -71,7 +72,7 @@ public async Task DeleteImposter_StatusCodeNotOk_ThrowsMountebankException()
71
72
{
72
73
var response = GetResponse ( HttpStatusCode . BadRequest ) ;
73
74
74
- _mockClient . Setup ( x => x . DeleteAsync ( It . IsAny < string > ( ) ) )
75
+ _mockClient . Setup ( x => x . DeleteAsync ( It . IsAny < string > ( ) , default ) )
75
76
. ReturnsAsync ( response ) ;
76
77
77
78
await _proxy . DeleteImposterAsync ( 123 ) . ConfigureAwait ( false ) ;
@@ -84,12 +85,12 @@ public async Task CreateImposter_SendsRequest_ImpostersResource()
84
85
85
86
var response = GetResponse ( HttpStatusCode . Created ) ;
86
87
87
- _mockClient . Setup ( x => x . PostAsync ( expectedResource , It . IsAny < HttpContent > ( ) ) )
88
+ _mockClient . Setup ( x => x . PostAsync ( expectedResource , It . IsAny < HttpContent > ( ) , default ) )
88
89
. ReturnsAsync ( response ) ;
89
90
90
91
await _proxy . CreateImposterAsync ( new HttpImposter ( 123 , null ) ) . ConfigureAwait ( false ) ;
91
92
92
- _mockClient . Verify ( x => x . PostAsync ( expectedResource , It . IsAny < HttpContent > ( ) ) , Times . Once ) ;
93
+ _mockClient . Verify ( x => x . PostAsync ( expectedResource , It . IsAny < HttpContent > ( ) , default ) , Times . Once ) ;
93
94
}
94
95
95
96
[ TestMethod ]
@@ -100,9 +101,9 @@ public async Task CreateImposter_SendsRequest_WithJsonBody()
100
101
var response = GetResponse ( HttpStatusCode . Created ) ;
101
102
102
103
HttpContent content = null ;
103
- _mockClient . Setup ( x => x . PostAsync ( It . IsAny < string > ( ) , It . IsAny < HttpContent > ( ) ) )
104
+ _mockClient . Setup ( x => x . PostAsync ( It . IsAny < string > ( ) , It . IsAny < HttpContent > ( ) , default ) )
104
105
. ReturnsAsync ( response )
105
- . Callback < string , HttpContent > ( ( res , cont ) => content = cont ) ;
106
+ . Callback < string , HttpContent , CancellationToken > ( ( res , cont , _ ) => content = cont ) ;
106
107
107
108
await _proxy . CreateImposterAsync ( new HttpImposter ( 123 , null ) ) . ConfigureAwait ( false ) ;
108
109
@@ -132,7 +133,7 @@ public async Task CreateImposter_SendsRequest_ImposterWithNoPort()
132
133
}
133
134
" ) ;
134
135
135
- _mockClient . Setup ( x => x . PostAsync ( It . IsAny < string > ( ) , It . IsAny < HttpContent > ( ) ) )
136
+ _mockClient . Setup ( x => x . PostAsync ( It . IsAny < string > ( ) , It . IsAny < HttpContent > ( ) , default ) )
136
137
. ReturnsAsync ( response ) ;
137
138
138
139
var imposter = new HttpImposter ( null , null ) ;
@@ -148,7 +149,7 @@ public async Task CreateImposter_StatusCodeNotCreated_ThrowsMountebankException(
148
149
{
149
150
var response = GetResponse ( HttpStatusCode . BadRequest ) ;
150
151
151
- _mockClient . Setup ( x => x . PostAsync ( It . IsAny < string > ( ) , It . IsAny < HttpContent > ( ) ) )
152
+ _mockClient . Setup ( x => x . PostAsync ( It . IsAny < string > ( ) , It . IsAny < HttpContent > ( ) , default ) )
152
153
. ReturnsAsync ( response ) ;
153
154
154
155
await _proxy . CreateImposterAsync ( new HttpImposter ( 123 , null ) ) . ConfigureAwait ( false ) ;
0 commit comments