예제 #1
0
        public void TestAllTypesEquality()
        {
            TestAllTypesLite msg  = TestAllTypesLite.DefaultInstance;
            TestAllTypesLite copy = msg.ToBuilder().Build();

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