diff options
author | Jon Skeet <jonskeet@google.com> | 2015-07-03 11:41:37 +0100 |
---|---|---|
committer | Jon Skeet <jonskeet@google.com> | 2015-07-09 08:26:07 +0100 |
commit | 14f2222a50a18ff0d8772095587b9cdad455a7bb (patch) | |
tree | 1422e99fad875a04921a0b8c881f48c63937f84c /csharp/src/ProtocolBuffers.Test/EqualityTester.cs | |
parent | af259b77bf04fcfb68609776cb27f04d289a2c39 (diff) | |
download | protobuf-14f2222a50a18ff0d8772095587b9cdad455a7bb.tar.gz protobuf-14f2222a50a18ff0d8772095587b9cdad455a7bb.tar.bz2 protobuf-14f2222a50a18ff0d8772095587b9cdad455a7bb.zip |
Lots more tests for FieldCodec, MapField, RepeatedField
... and some implementation changes to go with them.
Diffstat (limited to 'csharp/src/ProtocolBuffers.Test/EqualityTester.cs')
-rw-r--r-- | csharp/src/ProtocolBuffers.Test/EqualityTester.cs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/csharp/src/ProtocolBuffers.Test/EqualityTester.cs b/csharp/src/ProtocolBuffers.Test/EqualityTester.cs index b372443b..a669baba 100644 --- a/csharp/src/ProtocolBuffers.Test/EqualityTester.cs +++ b/csharp/src/ProtocolBuffers.Test/EqualityTester.cs @@ -45,15 +45,20 @@ namespace Google.Protobuf public static void AssertEquality<T>(T first, T second) where T : IEquatable<T> { Assert.IsTrue(first.Equals(second)); + Assert.IsTrue(first.Equals((object) second)); Assert.AreEqual(first.GetHashCode(), second.GetHashCode()); } public static void AssertInequality<T>(T first, T second) where T : IEquatable<T> { Assert.IsFalse(first.Equals(second)); + Assert.IsFalse(first.Equals((object) second)); // While this isn't a requirement, the chances of this test failing due to // coincidence rather than a bug are very small. - Assert.AreNotEqual(first.GetHashCode(), second.GetHashCode()); + if (first != null && second != null) + { + Assert.AreNotEqual(first.GetHashCode(), second.GetHashCode()); + } } } } |