-
-
Notifications
You must be signed in to change notification settings - Fork 110
/
ApprovalException.cs
30 lines (23 loc) · 1.03 KB
/
ApprovalException.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
namespace ApprovalTests.Core.Exceptions;
public class ApprovalException(string received, string approved) : Exception
{
public string Received { get; } = received;
public string Approved { get; } = approved;
protected bool Equals(ApprovalException other) => string.Equals(Approved, other.Approved) && string.Equals(Received, other.Received);
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
if (obj.GetType() != GetType()) return false;
return Equals((ApprovalException) obj);
}
public override int GetHashCode()
{
unchecked
{
return ((Approved != null ? Approved.GetHashCode() : 0) * 397) ^ (Received != null ? Received.GetHashCode() : 0);
}
}
public static bool operator ==(ApprovalException left, ApprovalException right) => Equals(left, right);
public static bool operator !=(ApprovalException left, ApprovalException right) => !Equals(left, right);
}