@@ -201,39 +201,51 @@ public void OptionalNoneExplicitOperatorShouldProduceExpectedResult()
201
201
public void OptionalSomeValuesShouldBeConsideredEqual ( )
202
202
{
203
203
// Given
204
- Optional < int > a = Optional < int > . Some ( 123 ) ;
205
- Optional < int > b = Optional < int > . Some ( 123 ) ;
204
+ Some < int > a = Optional < int > . Some ( 123 ) ;
205
+ Some < int > b = Optional < int > . Some ( 123 ) ;
206
+ object bObject = b ;
206
207
207
208
// When / Then
208
209
Assert . Equal ( a , b ) ;
209
- Assert . True ( a == b ) ;
210
+ Assert . Equal ( a , bObject ) ;
210
211
Assert . True ( a . Equals ( b ) ) ;
212
+ Assert . True ( a . Equals ( bObject ) ) ;
213
+ Assert . True ( a == b ) ;
214
+ Assert . False ( a != b ) ;
211
215
}
212
216
213
217
[ Fact ( DisplayName = "Optional Some values should not be considered equal." ) ]
214
218
public void OptionalSomeValuesShouldNotBeConsideredEqual ( )
215
219
{
216
220
// Given
217
- Optional < int > a = Optional < int > . Some ( 123 ) ;
218
- Optional < int > b = Optional < int > . Some ( 456 ) ;
221
+ Some < int > a = Optional < int > . Some ( 123 ) ;
222
+ Some < int > b = Optional < int > . Some ( 456 ) ;
223
+ object bObject = b ;
219
224
220
225
// When / Then
221
226
Assert . NotEqual ( a , b ) ;
222
- Assert . True ( a != b ) ;
227
+ Assert . NotEqual ( a , bObject ) ;
223
228
Assert . False ( a . Equals ( b ) ) ;
229
+ Assert . False ( a . Equals ( bObject ) ) ;
230
+ Assert . False ( a == b ) ;
231
+ Assert . True ( a != b ) ;
224
232
}
225
233
226
234
[ Fact ( DisplayName = "Optional None values should be considered equal." ) ]
227
235
public void OptionalNoneValuesShouldBeConsideredEqual ( )
228
236
{
229
237
// Given
230
- Optional < int > a = Optional < int > . None ;
231
- Optional < int > b = Optional < int > . None ;
238
+ None < int > a = Optional < int > . None ;
239
+ None < int > b = Optional < int > . None ;
240
+ object bObject = b ;
232
241
233
242
// When / Then
234
243
Assert . Equal ( a , b ) ;
235
- Assert . True ( a == b ) ;
244
+ Assert . Equal ( a , bObject ) ;
236
245
Assert . True ( a . Equals ( b ) ) ;
246
+ Assert . True ( a . Equals ( bObject ) ) ;
247
+ Assert . True ( a == b ) ;
248
+ Assert . False ( a != b ) ;
237
249
}
238
250
239
251
[ Fact ( DisplayName = "Optional Some and None values should not be considered equal." ) ]
@@ -242,11 +254,15 @@ public void OptionalSomeAndNoneValuesShouldNotBeConsideredEqual()
242
254
// Given
243
255
Optional < int > a = Optional < int > . Some ( 123 ) ;
244
256
Optional < int > b = Optional < int > . None ;
257
+ object bObject = b ;
245
258
246
259
// When / Then
247
260
Assert . NotEqual ( a , b ) ;
248
- Assert . True ( a != b ) ;
261
+ Assert . NotEqual ( a , bObject ) ;
249
262
Assert . False ( a . Equals ( b ) ) ;
263
+ Assert . False ( a . Equals ( bObject ) ) ;
264
+ Assert . False ( a == b ) ;
265
+ Assert . True ( a != b ) ;
250
266
}
251
267
252
268
[ Fact ( DisplayName = "Optional Some.GetHashCode should produce the expected result." ) ]
@@ -317,7 +333,8 @@ public void OptionalSomeGetValueOrDefaultWithDefaultValueShouldProduceExpectedRe
317
333
Optional < string > text = "abc" ;
318
334
319
335
// When
320
- int actualNumber = number . GetValueOrDefault ( 456 ) ;
336
+ int ? actualNumber = number . GetValueOrDefault ( 456 ) ;
337
+ // ReSharper disable once VariableCanBeNotNullable
321
338
string ? actualText = text . GetValueOrDefault ( "xyz" ) ;
322
339
323
340
// Then
0 commit comments