@@ -40,33 +40,35 @@ public static HttpClient MakeHttpClient(HttpStatusCode statusCode,
40
40
)
41
41
{
42
42
var response = new HttpResponseMessage ( statusCode ) ;
43
-
43
+
44
44
if ( ! string . IsNullOrWhiteSpace ( content ) )
45
45
{
46
46
response . Content = new StringContent ( content ) ;
47
47
}
48
48
49
49
var mockedHandler = new Mock < HttpMessageHandler > ( ) ;
50
- mockedHandler . Protected ( ) . Setup < Task < HttpResponseMessage > > (
50
+ mockedHandler . Protected ( )
51
+ . Setup < Task < HttpResponseMessage > > (
51
52
"SendAsync" ,
52
53
ItExpr . IsAny < HttpRequestMessage > ( ) ,
53
- ItExpr . IsAny < CancellationToken > ( ) ) .
54
- ReturnsAsync ( response ) ;
54
+ ItExpr . IsAny < CancellationToken > ( ) )
55
+ . ReturnsAsync ( response ) ;
55
56
return new HttpClient ( mockedHandler . Object ) ;
56
57
}
57
-
58
+
58
59
/// <summary>
59
60
/// Create an HttpClient instance that will timeout for SendAsync calls
60
61
/// </summary>
61
62
/// <returns>HttpClient instance that throw TimeoutException</returns>
62
63
public static HttpClient MakeHttpClientWithTimeout ( )
63
64
{
64
65
var mockedHandler = new Mock < HttpMessageHandler > ( ) ;
65
- mockedHandler . Protected ( ) . Setup < Task < HttpResponseMessage > > (
66
+ mockedHandler . Protected ( )
67
+ . Setup < Task < HttpResponseMessage > > (
66
68
"SendAsync" ,
67
69
ItExpr . IsAny < HttpRequestMessage > ( ) ,
68
- ItExpr . IsAny < CancellationToken > ( ) ) .
69
- Throws < TimeoutException > ( ) ;
70
+ ItExpr . IsAny < CancellationToken > ( ) )
71
+ . Throws < TimeoutException > ( ) ;
70
72
return new HttpClient ( mockedHandler . Object ) ;
71
73
}
72
74
}
0 commit comments