diff options
author | Jon Skeet <jonskeet@google.com> | 2015-10-24 06:45:20 +0100 |
---|---|---|
committer | Jon Skeet <jonskeet@google.com> | 2015-10-24 06:45:20 +0100 |
commit | 964627ece023577f252b888c9a9d6d9c2c563fc3 (patch) | |
tree | 8204a0d53d65c037407c8178110314cc4f6d3a8b /csharp | |
parent | 1abf297fb9762df6d52735026d2dd670f540a947 (diff) | |
download | protobuf-964627ece023577f252b888c9a9d6d9c2c563fc3.tar.gz protobuf-964627ece023577f252b888c9a9d6d9c2c563fc3.tar.bz2 protobuf-964627ece023577f252b888c9a9d6d9c2c563fc3.zip |
Include the oneof-case in equality and hash code generated code.
The included C# test will fail until the regenerated code is used, which is in the next commit.
Diffstat (limited to 'csharp')
-rw-r--r-- | csharp/src/Google.Protobuf.Test/GeneratedMessageTest.cs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/csharp/src/Google.Protobuf.Test/GeneratedMessageTest.cs b/csharp/src/Google.Protobuf.Test/GeneratedMessageTest.cs index 575d4586..1163f524 100644 --- a/csharp/src/Google.Protobuf.Test/GeneratedMessageTest.cs +++ b/csharp/src/Google.Protobuf.Test/GeneratedMessageTest.cs @@ -566,6 +566,16 @@ namespace Google.Protobuf }
[Test]
+ public void Oneof_DefaultValuesNotEqual()
+ {
+ var message1 = new TestAllTypes { OneofString = "" };
+ var message2 = new TestAllTypes { OneofUint32 = 0 };
+ Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.OneofString, message1.OneofFieldCase);
+ Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.OneofUint32, message2.OneofFieldCase);
+ Assert.AreNotEqual(message1, message2);
+ }
+
+ [Test]
public void OneofSerialization_NonDefaultValue()
{
var message = new TestAllTypes();
|