-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #47 from diegofrata/null-reference
Fixes null reference exception coming from System.HashCode in .NET 4.7
- Loading branch information
Showing
6 changed files
with
40 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
Generator.Equals.Tests/Runtime/DefaultEqualityComparerTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using FluentAssertions; | ||
using Xunit; | ||
|
||
namespace Generator.Equals.Tests.Runtime; | ||
|
||
public partial class DefaultEqualityComparerTests | ||
{ | ||
[Equatable] | ||
sealed partial class SealedClass | ||
{ | ||
} | ||
|
||
[Equatable] | ||
partial class NonSealedClass | ||
{ | ||
} | ||
|
||
|
||
[Fact] | ||
public void GetHashCode_SealedClass_NullValueShouldReturnZero() | ||
{ | ||
DefaultEqualityComparer<SealedClass>.Default.GetHashCode(null).Should().Be(0); | ||
} | ||
|
||
|
||
[Fact] | ||
public void GetHashCode_NonSealedClass_NullValueShouldReturnZero() | ||
{ | ||
DefaultEqualityComparer<NonSealedClass>.Default.GetHashCode(null).Should().Be(0); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters