@@ -57,30 +57,30 @@ public async Task CanParseInt64Async(string bencode, long value)
5757 [ InlineData ( "i012e" ) ]
5858 [ InlineData ( "i01234567890e" ) ]
5959 [ InlineData ( "i00001e" ) ]
60- public void LeadingZeros_ThrowsInvalidBencodeExceptionAsync ( string bencode )
60+ public async Task LeadingZeros_ThrowsInvalidBencodeExceptionAsync ( string bencode )
6161 {
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 > > ( ) )
6464 . WithMessage ( "*Leading '0's are not valid.*" )
6565 . Which . StreamPosition . Should ( ) . Be ( 0 ) ;
6666 }
6767
6868 [ Fact ]
69- public void MinusZero_ThrowsInvalidBencodeExceptionAsync ( )
69+ public async Task MinusZero_ThrowsInvalidBencodeExceptionAsync ( )
7070 {
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 > > ( ) )
7373 . WithMessage ( "*'-0' is not a valid number.*" )
7474 . Which . StreamPosition . Should ( ) . Be ( 0 ) ;
7575 }
7676
7777 [ Theory ]
7878 [ InlineData ( "i12" ) ]
7979 [ InlineData ( "i123" ) ]
80- public void MissingEndChar_ThrowsInvalidBencodeExceptionAsync ( string bencode )
80+ public async Task MissingEndChar_ThrowsInvalidBencodeExceptionAsync ( string bencode )
8181 {
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 > > ( ) )
8484 . WithMessage ( "*Missing end character of object.*" )
8585 . Which . StreamPosition . Should ( ) . Be ( 0 ) ;
8686 }
@@ -92,19 +92,19 @@ public void MissingEndChar_ThrowsInvalidBencodeExceptionAsync(string bencode)
9292 [ InlineData ( "l42e" ) ]
9393 [ InlineData ( "100e" ) ]
9494 [ InlineData ( "1234567890e" ) ]
95- public void InvalidFirstChar_ThrowsInvalidBencodeExceptionAsync ( string bencode )
95+ public async Task InvalidFirstChar_ThrowsInvalidBencodeExceptionAsync ( string bencode )
9696 {
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 > > ( ) )
9999 . WithMessage ( "*Unexpected character. Expected 'i'*" )
100100 . Which . StreamPosition . Should ( ) . Be ( 0 ) ;
101101 }
102102
103103 [ Fact ]
104- public void JustNegativeSign_ThrowsInvalidBencodeExceptionAsync ( )
104+ public async Task JustNegativeSign_ThrowsInvalidBencodeExceptionAsync ( )
105105 {
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 > > ( ) )
108108 . WithMessage ( "*It contains no digits.*" )
109109 . Which . StreamPosition . Should ( ) . Be ( 0 ) ;
110110 }
@@ -114,10 +114,10 @@ public void JustNegativeSign_ThrowsInvalidBencodeExceptionAsync()
114114 [ InlineData ( "i--42e" ) ]
115115 [ InlineData ( "i---100e" ) ]
116116 [ InlineData ( "i----1234567890e" ) ]
117- public void MoreThanOneNegativeSign_ThrowsInvalidBencodeExceptionAsync ( string bencode )
117+ public async Task MoreThanOneNegativeSign_ThrowsInvalidBencodeExceptionAsync ( string bencode )
118118 {
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 > > ( ) )
121121 . WithMessage ( "*The value '*' is not a valid number.*" )
122122 . Which . StreamPosition . Should ( ) . Be ( 0 ) ;
123123 }
@@ -128,10 +128,10 @@ public void MoreThanOneNegativeSign_ThrowsInvalidBencodeExceptionAsync(string be
128128 [ InlineData ( "i.e" ) ]
129129 [ InlineData ( "i42.e" ) ]
130130 [ InlineData ( "i42ae" ) ]
131- public void NonDigit_ThrowsInvalidBencodeExceptionAsync ( string bencode )
131+ public async Task NonDigit_ThrowsInvalidBencodeExceptionAsync ( string bencode )
132132 {
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 > > ( ) )
135135 . WithMessage ( "*The value '*' is not a valid number.*" )
136136 . Which . StreamPosition . Should ( ) . Be ( 0 ) ;
137137 }
@@ -141,21 +141,21 @@ public void NonDigit_ThrowsInvalidBencodeExceptionAsync(string bencode)
141141 [ InlineData ( "" , "reached end of stream" ) ]
142142 [ InlineData ( "i" , "contains no digits" ) ]
143143 [ InlineData ( "ie" , "contains no digits" ) ]
144- public void BelowMinimumLength_ThrowsInvalidBencodeExceptionAsync ( string bencode , string exceptionMessage )
144+ public async Task BelowMinimumLength_ThrowsInvalidBencodeExceptionAsync ( string bencode , string exceptionMessage )
145145 {
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 > > ( ) )
148148 . WithMessage ( $ "*{ exceptionMessage } *")
149149 . Which . StreamPosition . Should ( ) . Be ( 0 ) ;
150150 }
151151
152152 [ Theory ]
153153 [ InlineData ( "i9223372036854775808e" ) ]
154154 [ InlineData ( "i-9223372036854775809e" ) ]
155- public void LargerThanInt64_ThrowsUnsupportedExceptionAsync ( string bencode )
155+ public async Task LargerThanInt64_ThrowsUnsupportedExceptionAsync ( string bencode )
156156 {
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 > > ( ) )
159159 . WithMessage ( "*The value '*' is not a valid long (Int64)*" )
160160 . Which . StreamPosition . Should ( ) . Be ( 0 ) ;
161161 }
@@ -164,10 +164,10 @@ public void LargerThanInt64_ThrowsUnsupportedExceptionAsync(string bencode)
164164 [ InlineData ( "i12345678901234567890e" ) ]
165165 [ InlineData ( "i123456789012345678901e" ) ]
166166 [ InlineData ( "i123456789012345678901234567890e" ) ]
167- public void LongerThanMaxDigits19_ThrowsUnsupportedExceptionAsync ( string bencode )
167+ public async Task LongerThanMaxDigits19_ThrowsUnsupportedExceptionAsync ( string bencode )
168168 {
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 > > ( ) )
171171 . WithMessage ( "*The number '*' has more than 19 digits and cannot be stored as a long*" )
172172 . Which . StreamPosition . Should ( ) . Be ( 0 ) ;
173173 }
0 commit comments