public void TestNegativeEnumArray() { int arraySize = 1 + 1 + (11 * 5); int msgSize = arraySize; byte[] bytes = new byte[msgSize]; CodedOutputStream output = CodedOutputStream.CreateInstance(bytes); output.WriteInt32Array(8, "", new int[] { 0, -1, -2, -3, -4, -5 }); Assert.AreEqual(0, output.SpaceLeft); CodedInputStream input = CodedInputStream.CreateInstance(bytes); uint tag; string name; Assert.IsTrue(input.ReadTag(out tag, out name)); List <TestNegEnum> values = new List <TestNegEnum>(); ICollection <object> unk; input.ReadEnumArray(tag, name, values, out unk); Assert.AreEqual(2, values.Count); Assert.AreEqual(TestNegEnum.None, values[0]); Assert.AreEqual(TestNegEnum.Value, values[1]); Assert.IsNotNull(unk); Assert.AreEqual(4, unk.Count); }