Ejemplo n.º 1
0
        public void TestEqualityOnExtensions()
        {
            TestAllExtensionsLite msg  = TestAllExtensionsLite.DefaultInstance;
            TestAllExtensionsLite copy = msg.ToBuilder().Build();

            Assert.AreEqual(msg.GetHashCode(), copy.GetHashCode());
            Assert.IsTrue(msg.Equals(copy));
            msg = msg.ToBuilder().SetExtension(UnitTestLiteProtoFile.OptionalStringExtensionLite, "Hi").Build();
            Assert.AreNotEqual(msg.GetHashCode(), copy.GetHashCode());
            Assert.IsFalse(msg.Equals(copy));
            copy = copy.ToBuilder().SetExtension(UnitTestLiteProtoFile.OptionalStringExtensionLite, "Hi").Build();
            Assert.AreEqual(msg.GetHashCode(), copy.GetHashCode());
            Assert.IsTrue(msg.Equals(copy));
        }