예제 #1
0
        public void RequiredForeign()
        {
            TestRequiredForeign.Builder builder = TestRequiredForeign.CreateBuilder();

            Assert.IsTrue(builder.IsInitialized);

            builder.SetOptionalMessage(TestRequiredUninitialized);
            Assert.IsFalse(builder.IsInitialized);

            builder.SetOptionalMessage(TestRequiredInitialized);
            Assert.IsTrue(builder.IsInitialized);

            builder.AddRepeatedMessage(TestRequiredUninitialized);
            Assert.IsFalse(builder.IsInitialized);

            builder.SetRepeatedMessage(0, TestRequiredInitialized);
            Assert.IsTrue(builder.IsInitialized);
        }
        public void ForeignIsInitialized()
        {
            TestRequiredForeign.Builder    builder         = TestRequiredForeign.CreateBuilder();
            AbstractMessageWrapper.Builder abstractBuilder = new AbstractMessageWrapper.Builder(builder);

            Assert.IsTrue(abstractBuilder.IsInitialized);

            builder.SetOptionalMessage(TestRequiredUninitialized);
            Assert.IsFalse(abstractBuilder.IsInitialized);

            builder.SetOptionalMessage(TestRequiredInitialized);
            Assert.IsTrue(abstractBuilder.IsInitialized);

            builder.AddRepeatedMessage(TestRequiredUninitialized);
            Assert.IsFalse(abstractBuilder.IsInitialized);

            builder.SetRepeatedMessage(0, TestRequiredInitialized);
            Assert.IsTrue(abstractBuilder.IsInitialized);
        }