This repository was archived by the owner on Nov 20, 2018. It is now read-only.
File tree 2 files changed +8
-2
lines changed
src/Microsoft.AspNetCore.Http.Abstractions
test/Microsoft.AspNetCore.Http.Abstractions.Tests
2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -224,7 +224,7 @@ public bool Equals(PathString other)
224
224
/// <returns>True if both PathString values are equal</returns>
225
225
public bool Equals ( PathString other , StringComparison comparisonType )
226
226
{
227
- if ( ! this . HasValue && ! other . HasValue )
227
+ if ( ! HasValue && ! other . HasValue )
228
228
{
229
229
return true ;
230
230
}
@@ -251,7 +251,7 @@ public override bool Equals(object obj)
251
251
/// <returns>The hash code</returns>
252
252
public override int GetHashCode ( )
253
253
{
254
- return ( _value != null ? StringComparer . OrdinalIgnoreCase . GetHashCode ( _value ) : 0 ) ;
254
+ return ( HasValue ? StringComparer . OrdinalIgnoreCase . GetHashCode ( _value ) : 0 ) ;
255
255
}
256
256
257
257
/// <summary>
Original file line number Diff line number Diff line change @@ -48,6 +48,12 @@ public void NotEquals_EmptyPathStringAndNonNullPathString()
48
48
Assert . NotEqual ( pathString , PathString . Empty ) ;
49
49
}
50
50
51
+ [ Fact ]
52
+ public void HashCode_CheckNullAndEmptyHaveSameHashcodes ( )
53
+ {
54
+ Assert . Equal ( PathString . Empty . GetHashCode ( ) , default ( PathString ) . GetHashCode ( ) ) ;
55
+ }
56
+
51
57
[ Theory ]
52
58
[ InlineData ( null , null ) ]
53
59
[ InlineData ( "" , null ) ]
You can’t perform that action at this time.
0 commit comments