public void TestOneofMerge_String()
        {
            TestOneof2.Builder builder  = TestOneof2.CreateBuilder();
            TestOneof2         message  = builder.SetFooString("foo").Build();
            TestOneof2         message2 = TestOneof2.CreateBuilder().MergeFrom(message).Build();

            Assert.IsTrue(message2.HasFooString);
            Assert.AreEqual(message2.FooString, "foo");
        }
        public void TestOneofSerialization_String()
        {
            TestOneof2.Builder builder    = TestOneof2.CreateBuilder();
            TestOneof2         message    = builder.SetFooString("foo").Build();
            ByteString         serialized = message.ToByteString();
            TestOneof2         message2   = TestOneof2.ParseFrom(serialized);

            Assert.IsTrue(message2.HasFooString);
            Assert.AreEqual(message2.FooString, "foo");
        }
        public void TestOneofTypes_String()
        {
            TestOneof2.Builder builder = TestOneof2.CreateBuilder();
            Assert.AreEqual(builder.FooString, "");
            Assert.IsTrue(builder.SetFooString("foo").HasFooString);
            Assert.AreEqual(builder.FooString, "foo");
            TestOneof2 message = builder.BuildPartial();

            Assert.IsTrue(message.HasFooString);
            Assert.AreEqual(message.FooString, "foo");

            Assert.IsFalse(builder.ClearFooString().HasFooString);
            TestOneof2 message2 = builder.Build();

            Assert.IsFalse(message2.HasFooString);
            Assert.AreEqual(message2.FooString, "");

            builder.SetFooInt(123);
            Assert.AreEqual(builder.FooString, "");
            Assert.AreEqual(builder.FooInt, 123);
            message = builder.Build();
            Assert.AreEqual(message.FooString, "");
            Assert.AreEqual(message.FooInt, 123);
        }