public void DoesNotAddNullToStringListByAddRange()
 {
     TestAllTypes.Builder b = new TestAllTypes.Builder();
     AssertThrows <ArgumentNullException>(
         () => b.AddRangeRepeatedString(new String[] { null })
         );
 }
Exemplo n.º 2
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 }));
        }
 public void DoesNotEnumerateTwiceForStringList()
 {
     TestAllTypes.Builder b = new TestAllTypes.Builder();
     b.AddRangeRepeatedString(new OneTimeEnumerator <string>("test"));
 }