Skip to content

Commit

Permalink
Added Equals(object) tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jstedfast committed Jun 24, 2024
1 parent 5d26569 commit eb9ca94
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions UnitTests/Tnef/TnefNameIdTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public void TestEqualityById ()

Assert.That (tnef2.GetHashCode (), Is.EqualTo (tnef1.GetHashCode ()), "GetHashCode");
Assert.That (tnef2, Is.EqualTo (tnef1), "Equals");
Assert.That ((object) tnef2, Is.EqualTo ((object) tnef1), "Equals (object)");

Assert.That (tnef1 == tnef2, Is.True, "==");
Assert.That (tnef1 != tnef2, Is.False, "!=");
Expand All @@ -83,6 +84,7 @@ public void TestEqualityByName ()

Assert.That (tnef2.GetHashCode (), Is.EqualTo (tnef1.GetHashCode ()), "GetHashCode");
Assert.That (tnef2, Is.EqualTo (tnef1), "Equals");
Assert.That ((object) tnef2, Is.EqualTo ((object) tnef1), "Equals (object)");

Assert.That (tnef1 == tnef2, Is.True, "==");
Assert.That (tnef1 != tnef2, Is.False, "!=");
Expand Down
3 changes: 3 additions & 0 deletions UnitTests/Tnef/TnefPropertyTagTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public void TestBuiltIns ()

Assert.That (tag.GetHashCode (), Is.EqualTo (propertyTag.GetHashCode ()), $"{field.Name}.GetHashCode #1");
Assert.That (tag, Is.EqualTo (propertyTag), $"{field.Name}.Equals #1");
Assert.That ((object) tag, Is.EqualTo ((object) propertyTag), $"{field.Name}.Equals(object) #1");
Assert.That (tag == propertyTag, Is.True, $"{field.Name} == #1");
Assert.That (tag != propertyTag, Is.False, $"{field.Name} != #1");

Expand All @@ -64,6 +65,7 @@ public void TestBuiltIns ()

Assert.That (tag.GetHashCode (), Is.EqualTo (propertyTag.GetHashCode ()), $"{field.Name}.GetHashCode #2");
Assert.That (tag, Is.EqualTo (propertyTag), $"{field.Name}.Equals #2");
Assert.That ((object) tag, Is.EqualTo ((object) propertyTag), $"{field.Name}.Equals(object) #2");
Assert.That (tag == propertyTag, Is.True, $"{field.Name} == #2");
Assert.That (tag != propertyTag, Is.False, $"{field.Name} != #2");

Expand All @@ -77,6 +79,7 @@ public void TestBuiltIns ()

Assert.That (tag.GetHashCode (), Is.EqualTo (propertyTag.GetHashCode ()), $"{field.Name}.GetHashCode #3");
Assert.That (tag, Is.EqualTo (propertyTag), $"{field.Name}.Equals #3");
Assert.That ((object) tag, Is.EqualTo ((object) propertyTag), $"{field.Name}.Equals(object) #3");
Assert.That (tag == propertyTag, Is.True, $"{field.Name} == #3");
Assert.That (tag != propertyTag, Is.False, $"{field.Name} != #3");
}
Expand Down

0 comments on commit eb9ca94

Please sign in to comment.