Skip to content

Commit

Permalink
add more test case ,disable S3249
Browse files Browse the repository at this point in the history
  • Loading branch information
witskeeper committed Feb 21, 2024
1 parent 1e1a009 commit 75926b6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Domain.Abstractions/Entity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ public override int GetHashCode()
}
else
{
#pragma warning disable S3249
return base.GetHashCode();
#pragma warning restore S3249
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,21 @@ public void GetHashCode_Should_Not_Equal_With_Different_With_Id_And_No_Id()
Assert.NotEqual(order1.GetHashCode(), order2.GetHashCode());
}


[Fact]
public void GetHashCode_Should_Equal_Get_Two_Times_With_Id()
{
var order1 = new Order1(1);
Assert.Equal(order1.GetHashCode(), order1.GetHashCode());
}

[Fact]
public void GetHashCode_Should_Equal_Get_Two_Times_With_No_Id()
{
var order1 = new Order1();
Assert.Equal(order1.GetHashCode(), order1.GetHashCode());
}

public class Order1 : Entity<OrderId1>
{
public Order1()
Expand Down

0 comments on commit 75926b6

Please sign in to comment.