@@ -57,30 +57,30 @@ public async Task CanParseInt64Async(string bencode, long value)
57
57
[ InlineData ( "i012e" ) ]
58
58
[ InlineData ( "i01234567890e" ) ]
59
59
[ InlineData ( "i00001e" ) ]
60
- public void LeadingZeros_ThrowsInvalidBencodeExceptionAsync ( string bencode )
60
+ public async Task LeadingZeros_ThrowsInvalidBencodeExceptionAsync ( string bencode )
61
61
{
62
- Func < Task > action = async ( ) => await Parser . ParseStringAsync ( bencode ) ;
63
- action . Should ( ) . Throw < InvalidBencodeException < BNumber > > ( )
62
+ var action = async ( ) => await Parser . ParseStringAsync ( bencode ) ;
63
+ ( await action . Should ( ) . ThrowAsync < InvalidBencodeException < BNumber > > ( ) )
64
64
. WithMessage ( "*Leading '0's are not valid.*" )
65
65
. Which . StreamPosition . Should ( ) . Be ( 0 ) ;
66
66
}
67
67
68
68
[ Fact ]
69
- public void MinusZero_ThrowsInvalidBencodeExceptionAsync ( )
69
+ public async Task MinusZero_ThrowsInvalidBencodeExceptionAsync ( )
70
70
{
71
- Func < Task > action = async ( ) => await Parser . ParseStringAsync ( "i-0e" ) ;
72
- action . Should ( ) . Throw < InvalidBencodeException < BNumber > > ( )
71
+ var action = async ( ) => await Parser . ParseStringAsync ( "i-0e" ) ;
72
+ ( await action . Should ( ) . ThrowAsync < InvalidBencodeException < BNumber > > ( ) )
73
73
. WithMessage ( "*'-0' is not a valid number.*" )
74
74
. Which . StreamPosition . Should ( ) . Be ( 0 ) ;
75
75
}
76
76
77
77
[ Theory ]
78
78
[ InlineData ( "i12" ) ]
79
79
[ InlineData ( "i123" ) ]
80
- public void MissingEndChar_ThrowsInvalidBencodeExceptionAsync ( string bencode )
80
+ public async Task MissingEndChar_ThrowsInvalidBencodeExceptionAsync ( string bencode )
81
81
{
82
- Func < Task > action = async ( ) => await Parser . ParseStringAsync ( bencode ) ;
83
- action . Should ( ) . Throw < InvalidBencodeException < BNumber > > ( )
82
+ var action = async ( ) => await Parser . ParseStringAsync ( bencode ) ;
83
+ ( await action . Should ( ) . ThrowAsync < InvalidBencodeException < BNumber > > ( ) )
84
84
. WithMessage ( "*Missing end character of object.*" )
85
85
. Which . StreamPosition . Should ( ) . Be ( 0 ) ;
86
86
}
@@ -92,19 +92,19 @@ public void MissingEndChar_ThrowsInvalidBencodeExceptionAsync(string bencode)
92
92
[ InlineData ( "l42e" ) ]
93
93
[ InlineData ( "100e" ) ]
94
94
[ InlineData ( "1234567890e" ) ]
95
- public void InvalidFirstChar_ThrowsInvalidBencodeExceptionAsync ( string bencode )
95
+ public async Task InvalidFirstChar_ThrowsInvalidBencodeExceptionAsync ( string bencode )
96
96
{
97
- Func < Task > action = async ( ) => await Parser . ParseStringAsync ( bencode ) ;
98
- action . Should ( ) . Throw < InvalidBencodeException < BNumber > > ( )
97
+ var action = async ( ) => await Parser . ParseStringAsync ( bencode ) ;
98
+ ( await action . Should ( ) . ThrowAsync < InvalidBencodeException < BNumber > > ( ) )
99
99
. WithMessage ( "*Unexpected character. Expected 'i'*" )
100
100
. Which . StreamPosition . Should ( ) . Be ( 0 ) ;
101
101
}
102
102
103
103
[ Fact ]
104
- public void JustNegativeSign_ThrowsInvalidBencodeExceptionAsync ( )
104
+ public async Task JustNegativeSign_ThrowsInvalidBencodeExceptionAsync ( )
105
105
{
106
- Func < Task > action = async ( ) => await Parser . ParseStringAsync ( "i-e" ) ;
107
- action . Should ( ) . Throw < InvalidBencodeException < BNumber > > ( )
106
+ var action = async ( ) => await Parser . ParseStringAsync ( "i-e" ) ;
107
+ ( await action . Should ( ) . ThrowAsync < InvalidBencodeException < BNumber > > ( ) )
108
108
. WithMessage ( "*It contains no digits.*" )
109
109
. Which . StreamPosition . Should ( ) . Be ( 0 ) ;
110
110
}
@@ -114,10 +114,10 @@ public void JustNegativeSign_ThrowsInvalidBencodeExceptionAsync()
114
114
[ InlineData ( "i--42e" ) ]
115
115
[ InlineData ( "i---100e" ) ]
116
116
[ InlineData ( "i----1234567890e" ) ]
117
- public void MoreThanOneNegativeSign_ThrowsInvalidBencodeExceptionAsync ( string bencode )
117
+ public async Task MoreThanOneNegativeSign_ThrowsInvalidBencodeExceptionAsync ( string bencode )
118
118
{
119
- Func < Task > action = async ( ) => await Parser . ParseStringAsync ( bencode ) ;
120
- action . Should ( ) . Throw < InvalidBencodeException < BNumber > > ( )
119
+ var action = async ( ) => await Parser . ParseStringAsync ( bencode ) ;
120
+ ( await action . Should ( ) . ThrowAsync < InvalidBencodeException < BNumber > > ( ) )
121
121
. WithMessage ( "*The value '*' is not a valid number.*" )
122
122
. Which . StreamPosition . Should ( ) . Be ( 0 ) ;
123
123
}
@@ -128,10 +128,10 @@ public void MoreThanOneNegativeSign_ThrowsInvalidBencodeExceptionAsync(string be
128
128
[ InlineData ( "i.e" ) ]
129
129
[ InlineData ( "i42.e" ) ]
130
130
[ InlineData ( "i42ae" ) ]
131
- public void NonDigit_ThrowsInvalidBencodeExceptionAsync ( string bencode )
131
+ public async Task NonDigit_ThrowsInvalidBencodeExceptionAsync ( string bencode )
132
132
{
133
- Func < Task > action = async ( ) => await Parser . ParseStringAsync ( bencode ) ;
134
- action . Should ( ) . Throw < InvalidBencodeException < BNumber > > ( )
133
+ var action = async ( ) => await Parser . ParseStringAsync ( bencode ) ;
134
+ ( await action . Should ( ) . ThrowAsync < InvalidBencodeException < BNumber > > ( ) )
135
135
. WithMessage ( "*The value '*' is not a valid number.*" )
136
136
. Which . StreamPosition . Should ( ) . Be ( 0 ) ;
137
137
}
@@ -141,21 +141,21 @@ public void NonDigit_ThrowsInvalidBencodeExceptionAsync(string bencode)
141
141
[ InlineData ( "" , "reached end of stream" ) ]
142
142
[ InlineData ( "i" , "contains no digits" ) ]
143
143
[ InlineData ( "ie" , "contains no digits" ) ]
144
- public void BelowMinimumLength_ThrowsInvalidBencodeExceptionAsync ( string bencode , string exceptionMessage )
144
+ public async Task BelowMinimumLength_ThrowsInvalidBencodeExceptionAsync ( string bencode , string exceptionMessage )
145
145
{
146
- Func < Task > action = async ( ) => await Parser . ParseStringAsync ( bencode ) ;
147
- action . Should ( ) . Throw < InvalidBencodeException < BNumber > > ( )
146
+ var action = async ( ) => await Parser . ParseStringAsync ( bencode ) ;
147
+ ( await action . Should ( ) . ThrowAsync < InvalidBencodeException < BNumber > > ( ) )
148
148
. WithMessage ( $ "*{ exceptionMessage } *")
149
149
. Which . StreamPosition . Should ( ) . Be ( 0 ) ;
150
150
}
151
151
152
152
[ Theory ]
153
153
[ InlineData ( "i9223372036854775808e" ) ]
154
154
[ InlineData ( "i-9223372036854775809e" ) ]
155
- public void LargerThanInt64_ThrowsUnsupportedExceptionAsync ( string bencode )
155
+ public async Task LargerThanInt64_ThrowsUnsupportedExceptionAsync ( string bencode )
156
156
{
157
- Func < Task > action = async ( ) => await Parser . ParseStringAsync ( bencode ) ;
158
- action . Should ( ) . Throw < UnsupportedBencodeException < BNumber > > ( )
157
+ var action = async ( ) => await Parser . ParseStringAsync ( bencode ) ;
158
+ ( await action . Should ( ) . ThrowAsync < UnsupportedBencodeException < BNumber > > ( ) )
159
159
. WithMessage ( "*The value '*' is not a valid long (Int64)*" )
160
160
. Which . StreamPosition . Should ( ) . Be ( 0 ) ;
161
161
}
@@ -164,10 +164,10 @@ public void LargerThanInt64_ThrowsUnsupportedExceptionAsync(string bencode)
164
164
[ InlineData ( "i12345678901234567890e" ) ]
165
165
[ InlineData ( "i123456789012345678901e" ) ]
166
166
[ InlineData ( "i123456789012345678901234567890e" ) ]
167
- public void LongerThanMaxDigits19_ThrowsUnsupportedExceptionAsync ( string bencode )
167
+ public async Task LongerThanMaxDigits19_ThrowsUnsupportedExceptionAsync ( string bencode )
168
168
{
169
- Func < Task > action = async ( ) => await Parser . ParseStringAsync ( bencode ) ;
170
- action . Should ( ) . Throw < UnsupportedBencodeException < BNumber > > ( )
169
+ var action = async ( ) => await Parser . ParseStringAsync ( bencode ) ;
170
+ ( await action . Should ( ) . ThrowAsync < UnsupportedBencodeException < BNumber > > ( ) )
171
171
. WithMessage ( "*The number '*' has more than 19 digits and cannot be stored as a long*" )
172
172
. Which . StreamPosition . Should ( ) . Be ( 0 ) ;
173
173
}
0 commit comments