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); }