Skip to content

Commit 7f47487

Browse files
Merge pull request #138 from jimmym715/recorded-binding-equals-implementation-fix
Fixed Implementation of Equals in RecordedBinding
2 parents c800e80 + 1a771e9 commit 7f47487

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

projects/client/RabbitMQ.Client/src/client/impl/RecordedBinding.cs

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,23 +53,31 @@ public RecordedBinding(AutorecoveringModel model) : base(model)
5353
public string Destination { get; set; }
5454
public string RoutingKey { get; protected set; }
5555
public string Source { get; protected set; }
56+
57+
public bool Equals(RecordedBinding other)
58+
{
59+
return other != null &&
60+
(Source.Equals(other.Source)) &&
61+
(Destination.Equals(other.Destination)) &&
62+
(RoutingKey.Equals(other.RoutingKey)) &&
63+
(Arguments == other.Arguments);
64+
}
5665

57-
public bool Equals(RecordedBinding other)
66+
public override bool Equals(object obj)
5867
{
59-
if (ReferenceEquals(other, null))
68+
if (ReferenceEquals(obj, null))
6069
{
6170
return false;
6271
}
6372

64-
if (ReferenceEquals(this, other))
73+
if (ReferenceEquals(this, obj))
6574
{
6675
return true;
6776
}
6877

69-
return (Source.Equals(other.Source)) &&
70-
(Destination.Equals(other.Destination)) &&
71-
(RoutingKey.Equals(other.RoutingKey)) &&
72-
(Arguments == other.Arguments);
78+
var other = obj as RecordedBinding;
79+
80+
return Equals(other);
7381
}
7482

7583
public override int GetHashCode()

0 commit comments

Comments
 (0)