Skip to content
This repository was archived by the owner on Nov 20, 2018. It is now read-only.

Commit b4d8918

Browse files
author
Justin Kotalik
committed
Add Fixes Chris Suggested
1 parent b2649d2 commit b4d8918

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/Microsoft.AspNetCore.Http.Abstractions/PathString.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ public string Add(QueryString other)
213213
/// <returns>True if both PathString values are equal</returns>
214214
public bool Equals(PathString other)
215215
{
216-
return this.Equals(other, StringComparison.OrdinalIgnoreCase);
216+
return Equals(other, StringComparison.OrdinalIgnoreCase);
217217
}
218218

219219
/// <summary>
@@ -240,7 +240,7 @@ public override bool Equals(object obj)
240240
{
241241
if (ReferenceEquals(null, obj))
242242
{
243-
return false;
243+
return !HasValue;
244244
}
245245
return obj is PathString && Equals((PathString)obj);
246246
}

test/Microsoft.AspNetCore.Http.Abstractions.Tests/PathStringTests.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ public void Equals_EmptyPathStringAndDefaultPathString()
2121
{
2222
// Act and Assert
2323
Assert.Equal(PathString.Empty, default(PathString));
24+
Assert.Equal(default(PathString), PathString.Empty);
25+
Assert.True(PathString.Empty == default(PathString));
26+
Assert.True(default(PathString) == PathString.Empty);
27+
Assert.True(PathString.Empty.Equals(default(PathString)));
28+
Assert.True(default(PathString).Equals(PathString.Empty));
2429
}
2530

2631
[Fact]

0 commit comments

Comments
 (0)