示例#1
0
        public void RepeatedAppendRejectsNull()
        {
            TestAllTypes.Builder builder = TestAllTypes.CreateBuilder();

            ForeignMessage foreignMessage = ForeignMessage.CreateBuilder().SetC(12).Build();

            TestUtil.AssertArgumentNullException(() => builder.AddRangeRepeatedForeignMessage(new[] { foreignMessage, null }));
            TestUtil.AssertArgumentNullException(() => builder.AddRangeRepeatedForeignMessage(null));
            TestUtil.AssertArgumentNullException(() => builder.AddRangeRepeatedForeignEnum(null));
            TestUtil.AssertArgumentNullException(() => builder.AddRangeRepeatedString(new[] { "one", null }));
            TestUtil.AssertArgumentNullException(() => builder.AddRangeRepeatedBytes(new[] { TestUtil.ToBytes("one"), null }));
        }
示例#2
0
 public void SettersRejectNull()
 {
     TestAllTypes.Builder builder = TestAllTypes.CreateBuilder();
     TestUtil.AssertArgumentNullException(() => builder.SetOptionalString(null));
     TestUtil.AssertArgumentNullException(() => builder.SetOptionalBytes(null));
     TestUtil.AssertArgumentNullException(() => builder.SetOptionalNestedMessage((TestAllTypes.Types.NestedMessage)null));
     TestUtil.AssertArgumentNullException(() => builder.SetOptionalNestedMessage((TestAllTypes.Types.NestedMessage.Builder)null));
     TestUtil.AssertArgumentNullException(() => builder.AddRepeatedString(null));
     TestUtil.AssertArgumentNullException(() => builder.AddRepeatedBytes(null));
     TestUtil.AssertArgumentNullException(() => builder.AddRepeatedNestedMessage((TestAllTypes.Types.NestedMessage)null));
     TestUtil.AssertArgumentNullException(() => builder.AddRepeatedNestedMessage((TestAllTypes.Types.NestedMessage.Builder)null));
 }