Lines Matching refs:message
50 var message = SampleMessages.CreateFullTestAllTypes(); in GetValue()
52 …Assert.AreEqual(message.SingleBool, fields[TestProtos.TestAllTypes.SingleBoolFieldNumber].Accessor… in GetValue()
53 …Assert.AreEqual(message.SingleBytes, fields[TestProtos.TestAllTypes.SingleBytesFieldNumber].Access… in GetValue()
54 …Assert.AreEqual(message.SingleDouble, fields[TestProtos.TestAllTypes.SingleDoubleFieldNumber].Acce… in GetValue()
55 …Assert.AreEqual(message.SingleFixed32, fields[TestProtos.TestAllTypes.SingleFixed32FieldNumber].Ac… in GetValue()
56 …Assert.AreEqual(message.SingleFixed64, fields[TestProtos.TestAllTypes.SingleFixed64FieldNumber].Ac… in GetValue()
57 …Assert.AreEqual(message.SingleFloat, fields[TestProtos.TestAllTypes.SingleFloatFieldNumber].Access… in GetValue()
58 …Assert.AreEqual(message.SingleForeignEnum, fields[TestProtos.TestAllTypes.SingleForeignEnumFieldNu… in GetValue()
59 …Assert.AreEqual(message.SingleForeignMessage, fields[TestProtos.TestAllTypes.SingleForeignMessageF… in GetValue()
60 …Assert.AreEqual(message.SingleImportEnum, fields[TestProtos.TestAllTypes.SingleImportEnumFieldNumb… in GetValue()
61 …Assert.AreEqual(message.SingleImportMessage, fields[TestProtos.TestAllTypes.SingleImportMessageFie… in GetValue()
62 …Assert.AreEqual(message.SingleInt32, fields[TestProtos.TestAllTypes.SingleInt32FieldNumber].Access… in GetValue()
63 …Assert.AreEqual(message.SingleInt64, fields[TestProtos.TestAllTypes.SingleInt64FieldNumber].Access… in GetValue()
64 …Assert.AreEqual(message.SingleNestedEnum, fields[TestProtos.TestAllTypes.SingleNestedEnumFieldNumb… in GetValue()
65 …Assert.AreEqual(message.SingleNestedMessage, fields[TestProtos.TestAllTypes.SingleNestedMessageFie… in GetValue()
66 …rt.AreEqual(message.SinglePublicImportMessage, fields[TestProtos.TestAllTypes.SinglePublicImportMe… in GetValue()
67 …Assert.AreEqual(message.SingleSint32, fields[TestProtos.TestAllTypes.SingleSint32FieldNumber].Acce… in GetValue()
68 …Assert.AreEqual(message.SingleSint64, fields[TestProtos.TestAllTypes.SingleSint64FieldNumber].Acce… in GetValue()
69 …Assert.AreEqual(message.SingleString, fields[TestProtos.TestAllTypes.SingleStringFieldNumber].Acce… in GetValue()
70 …Assert.AreEqual(message.SingleSfixed32, fields[TestProtos.TestAllTypes.SingleSfixed32FieldNumber].… in GetValue()
71 …Assert.AreEqual(message.SingleSfixed64, fields[TestProtos.TestAllTypes.SingleSfixed64FieldNumber].… in GetValue()
72 …Assert.AreEqual(message.SingleUint32, fields[TestProtos.TestAllTypes.SingleUint32FieldNumber].Acce… in GetValue()
73 …Assert.AreEqual(message.SingleUint64, fields[TestProtos.TestAllTypes.SingleUint64FieldNumber].Acce… in GetValue()
74 …Assert.AreEqual(message.OneofBytes, fields[TestProtos.TestAllTypes.OneofBytesFieldNumber].Accessor… in GetValue()
75 …Assert.AreEqual(message.OneofString, fields[TestProtos.TestAllTypes.OneofStringFieldNumber].Access… in GetValue()
76 …Assert.AreEqual(message.OneofNestedMessage, fields[TestProtos.TestAllTypes.OneofNestedMessageField… in GetValue()
77 …Assert.AreEqual(message.OneofUint32, fields[TestProtos.TestAllTypes.OneofUint32FieldNumber].Access… in GetValue()
80 …list = (IList) fields[TestProtos.TestAllTypes.RepeatedInt32FieldNumber].Accessor.GetValue(message); in GetValue()
81 Assert.AreEqual(message.RepeatedInt32, list); in GetValue()
82 … Assert.AreEqual(message.RepeatedInt32[0], list[0]); // Just in case there was any doubt... in GetValue()
95 IMessage message = SampleMessages.CreateFullTestAllTypes(); in GetValue_IncorrectType()
96 var fields = message.Descriptor.Fields; in GetValue_IncorrectType()
103 var message = new TestAllTypes(); in HasValue_Proto3_Message()
104 …var accessor = ((IMessage) message).Descriptor.Fields[TestProtos.TestAllTypes.SingleForeignMessage… in HasValue_Proto3_Message()
105 Assert.False(accessor.HasValue(message)); in HasValue_Proto3_Message()
106 message.SingleForeignMessage = new ForeignMessage(); in HasValue_Proto3_Message()
107 Assert.True(accessor.HasValue(message)); in HasValue_Proto3_Message()
108 message.SingleForeignMessage = null; in HasValue_Proto3_Message()
109 Assert.False(accessor.HasValue(message)); in HasValue_Proto3_Message()
115 TestAllTypes message = new TestAllTypes(); in HasValue_Proto3_Oneof()
116 …var accessor = ((IMessage) message).Descriptor.Fields[TestProtos.TestAllTypes.OneofStringFieldNumb… in HasValue_Proto3_Oneof()
117 Assert.False(accessor.HasValue(message)); in HasValue_Proto3_Oneof()
119 message.OneofString = ""; in HasValue_Proto3_Oneof()
120 Assert.True(accessor.HasValue(message)); in HasValue_Proto3_Oneof()
121 message.OneofString = "hello"; in HasValue_Proto3_Oneof()
122 Assert.True(accessor.HasValue(message)); in HasValue_Proto3_Oneof()
123 message.OneofUint32 = 10; in HasValue_Proto3_Oneof()
124 Assert.False(accessor.HasValue(message)); in HasValue_Proto3_Oneof()
130 var message = new TestProto3Optional(); in HasValue_Proto3_Primitive_Optional()
131 …var accessor = ((IMessage) message).Descriptor.Fields[TestProto3Optional.OptionalInt64FieldNumber]… in HasValue_Proto3_Primitive_Optional()
132 Assert.IsFalse(accessor.HasValue(message)); in HasValue_Proto3_Primitive_Optional()
133 message.OptionalInt64 = 5L; in HasValue_Proto3_Primitive_Optional()
134 Assert.IsTrue(accessor.HasValue(message)); in HasValue_Proto3_Primitive_Optional()
135 message.ClearOptionalInt64(); in HasValue_Proto3_Primitive_Optional()
136 Assert.IsFalse(accessor.HasValue(message)); in HasValue_Proto3_Primitive_Optional()
137 message.OptionalInt64 = 0L; in HasValue_Proto3_Primitive_Optional()
138 Assert.IsTrue(accessor.HasValue(message)); in HasValue_Proto3_Primitive_Optional()
144 IMessage message = SampleMessages.CreateFullTestAllTypes(); in HasValue_Proto3_Primitive_NotOptional()
145 var fields = message.Descriptor.Fields; in HasValue_Proto3_Primitive_NotOptional()
146 …Exception>(() => fields[TestProtos.TestAllTypes.SingleBoolFieldNumber].Accessor.HasValue(message)); in HasValue_Proto3_Primitive_NotOptional()
152 var message = new TestAllTypes(); in HasValue_Proto3_Repeated()
153 …var accessor = ((IMessage) message).Descriptor.Fields[TestProtos.TestAllTypes.RepeatedBoolFieldNum… in HasValue_Proto3_Repeated()
154 Assert.Throws<InvalidOperationException>(() => accessor.HasValue(message)); in HasValue_Proto3_Repeated()
160 var message = new Proto2.TestAllTypes(); in HasValue_Proto2_Primitive()
161 …var accessor = ((IMessage) message).Descriptor.Fields[Proto2.TestAllTypes.OptionalInt64FieldNumber… in HasValue_Proto2_Primitive()
163 Assert.IsFalse(accessor.HasValue(message)); in HasValue_Proto2_Primitive()
164 message.OptionalInt64 = 5L; in HasValue_Proto2_Primitive()
165 Assert.IsTrue(accessor.HasValue(message)); in HasValue_Proto2_Primitive()
166 message.ClearOptionalInt64(); in HasValue_Proto2_Primitive()
167 Assert.IsFalse(accessor.HasValue(message)); in HasValue_Proto2_Primitive()
168 message.OptionalInt64 = 0L; in HasValue_Proto2_Primitive()
169 Assert.IsTrue(accessor.HasValue(message)); in HasValue_Proto2_Primitive()
175 var message = new Proto2.TestAllTypes(); in HasValue_Proto2_Message()
176 …var field = ((IMessage) message).Descriptor.Fields[Proto2.TestAllTypes.OptionalForeignMessageField… in HasValue_Proto2_Message()
177 Assert.False(field.Accessor.HasValue(message)); in HasValue_Proto2_Message()
178 message.OptionalForeignMessage = new Proto2.ForeignMessage(); in HasValue_Proto2_Message()
179 Assert.True(field.Accessor.HasValue(message)); in HasValue_Proto2_Message()
180 message.OptionalForeignMessage = null; in HasValue_Proto2_Message()
181 Assert.False(field.Accessor.HasValue(message)); in HasValue_Proto2_Message()
187 var message = new Proto2.TestAllTypes(); in HasValue_Proto2_Oneof()
188 …var accessor = ((IMessage) message).Descriptor.Fields[Proto2.TestAllTypes.OneofStringFieldNumber].… in HasValue_Proto2_Oneof()
189 Assert.False(accessor.HasValue(message)); in HasValue_Proto2_Oneof()
191 message.OneofString = ""; in HasValue_Proto2_Oneof()
192 Assert.True(accessor.HasValue(message)); in HasValue_Proto2_Oneof()
193 message.OneofString = "hello"; in HasValue_Proto2_Oneof()
194 Assert.True(accessor.HasValue(message)); in HasValue_Proto2_Oneof()
195 message.OneofUint32 = 10; in HasValue_Proto2_Oneof()
196 Assert.False(accessor.HasValue(message)); in HasValue_Proto2_Oneof()
202 var message = new Proto2.TestAllTypes(); in HasValue_Proto2_Repeated()
203 …var accessor = ((IMessage) message).Descriptor.Fields[Proto2.TestAllTypes.RepeatedBoolFieldNumber]… in HasValue_Proto2_Repeated()
204 Assert.Throws<InvalidOperationException>(() => accessor.HasValue(message)); in HasValue_Proto2_Repeated()
211 var message = SampleMessages.CreateFullTestAllTypes(); in SetValue_SingleFields()
213 fields[TestProtos.TestAllTypes.SingleBoolFieldNumber].Accessor.SetValue(message, false); in SetValue_SingleFields()
214 fields[TestProtos.TestAllTypes.SingleInt32FieldNumber].Accessor.SetValue(message, 500); in SetValue_SingleFields()
215 …fields[TestProtos.TestAllTypes.SingleStringFieldNumber].Accessor.SetValue(message, "It's a string"… in SetValue_SingleFields()
216 …fields[TestProtos.TestAllTypes.SingleBytesFieldNumber].Accessor.SetValue(message, ByteString.CopyF… in SetValue_SingleFields()
217 …fields[TestProtos.TestAllTypes.SingleForeignEnumFieldNumber].Accessor.SetValue(message, ForeignEnu… in SetValue_SingleFields()
218 …stProtos.TestAllTypes.SingleForeignMessageFieldNumber].Accessor.SetValue(message, new ForeignMessa… in SetValue_SingleFields()
219 … fields[TestProtos.TestAllTypes.SingleDoubleFieldNumber].Accessor.SetValue(message, 20150701.5); in SetValue_SingleFields()
232 Assert.AreEqual(expected, message); in SetValue_SingleFields()
238 IMessage message = SampleMessages.CreateFullTestAllTypes(); in SetValue_SingleFields_WrongType()
239 var fields = message.Descriptor.Fields; in SetValue_SingleFields_WrongType()
240 … fields[TestProtos.TestAllTypes.SingleBoolFieldNumber].Accessor.SetValue(message, "This isn't a bo… in SetValue_SingleFields_WrongType()
246 IMessage message = new TestMap(); in SetValue_MapFields()
247 var fields = message.Descriptor.Fields; in SetValue_MapFields()
248 …tion>(() => fields[TestMap.MapStringStringFieldNumber].Accessor.SetValue(message, new Dictionary<s… in SetValue_MapFields()
254 IMessage message = SampleMessages.CreateFullTestAllTypes(); in SetValue_RepeatedFields()
255 var fields = message.Descriptor.Fields; in SetValue_RepeatedFields()
256 …lds[TestProtos.TestAllTypes.RepeatedDoubleFieldNumber].Accessor.SetValue(message, new double[10])); in SetValue_RepeatedFields()
262 var message = new TestAllTypes(); in Oneof()
267 Assert.IsNull(oneof.Accessor.GetCaseFieldDescriptor(message)); in Oneof()
269 message.OneofString = "foo"; in Oneof()
270 …s[TestProtos.TestAllTypes.OneofStringFieldNumber], oneof.Accessor.GetCaseFieldDescriptor(message)); in Oneof()
272 message.OneofUint32 = 10; in Oneof()
273 …s[TestProtos.TestAllTypes.OneofUint32FieldNumber], oneof.Accessor.GetCaseFieldDescriptor(message)); in Oneof()
275 oneof.Accessor.Clear(message); in Oneof()
276 … Assert.AreEqual(TestProtos.TestAllTypes.OneofFieldOneofCase.None, message.OneofFieldCase); in Oneof()
282 var message = SampleMessages.CreateFullTestAllTypes(); in Clear()
284 fields[TestProtos.TestAllTypes.SingleBoolFieldNumber].Accessor.Clear(message); in Clear()
285 fields[TestProtos.TestAllTypes.SingleInt32FieldNumber].Accessor.Clear(message); in Clear()
286 fields[TestProtos.TestAllTypes.SingleStringFieldNumber].Accessor.Clear(message); in Clear()
287 fields[TestProtos.TestAllTypes.SingleBytesFieldNumber].Accessor.Clear(message); in Clear()
288 fields[TestProtos.TestAllTypes.SingleForeignEnumFieldNumber].Accessor.Clear(message); in Clear()
289 fields[TestProtos.TestAllTypes.SingleForeignMessageFieldNumber].Accessor.Clear(message); in Clear()
290 fields[TestProtos.TestAllTypes.RepeatedDoubleFieldNumber].Accessor.Clear(message); in Clear()
303 Assert.AreEqual(expected, message); in Clear()
315 TestProto3Optional message = new TestProto3Optional in Clear_Proto3Optional()
323 Assert.True(message.HasOptionalInt32); in Clear_Proto3Optional()
324 Assert.NotNull(message.OptionalNestedMessage); in Clear_Proto3Optional()
326 primitiveField.Accessor.Clear(message); in Clear_Proto3Optional()
327 messageField.Accessor.Clear(message); in Clear_Proto3Optional()
329 Assert.False(message.HasOptionalInt32); in Clear_Proto3Optional()
330 Assert.Null(message.OptionalNestedMessage); in Clear_Proto3Optional()
336 var message = new TestAllTypes(); in Clear_Proto3_Oneof()
337 …var accessor = ((IMessage) message).Descriptor.Fields[TestProtos.TestAllTypes.OneofUint32FieldNumb… in Clear_Proto3_Oneof()
340 message.OneofString = "hello"; in Clear_Proto3_Oneof()
341 … Assert.AreEqual(TestProtos.TestAllTypes.OneofFieldOneofCase.OneofString, message.OneofFieldCase); in Clear_Proto3_Oneof()
342 accessor.Clear(message); in Clear_Proto3_Oneof()
343 … Assert.AreEqual(TestProtos.TestAllTypes.OneofFieldOneofCase.OneofString, message.OneofFieldCase); in Clear_Proto3_Oneof()
345 message.OneofUint32 = 100; in Clear_Proto3_Oneof()
346 … Assert.AreEqual(TestProtos.TestAllTypes.OneofFieldOneofCase.OneofUint32, message.OneofFieldCase); in Clear_Proto3_Oneof()
347 accessor.Clear(message); in Clear_Proto3_Oneof()
348 … Assert.AreEqual(TestProtos.TestAllTypes.OneofFieldOneofCase.None, message.OneofFieldCase); in Clear_Proto3_Oneof()
354 var message = new Proto2.TestAllTypes(); in Clear_Proto2_Oneof()
355 …var accessor = ((IMessage) message).Descriptor.Fields[Proto2.TestAllTypes.OneofUint32FieldNumber].… in Clear_Proto2_Oneof()
358 message.OneofString = "hello"; in Clear_Proto2_Oneof()
359 … Assert.AreEqual(Proto2.TestAllTypes.OneofFieldOneofCase.OneofString, message.OneofFieldCase); in Clear_Proto2_Oneof()
360 accessor.Clear(message); in Clear_Proto2_Oneof()
361 … Assert.AreEqual(Proto2.TestAllTypes.OneofFieldOneofCase.OneofString, message.OneofFieldCase); in Clear_Proto2_Oneof()
363 message.OneofUint32 = 100; in Clear_Proto2_Oneof()
364 … Assert.AreEqual(Proto2.TestAllTypes.OneofFieldOneofCase.OneofUint32, message.OneofFieldCase); in Clear_Proto2_Oneof()
365 accessor.Clear(message); in Clear_Proto2_Oneof()
366 Assert.AreEqual(Proto2.TestAllTypes.OneofFieldOneofCase.None, message.OneofFieldCase); in Clear_Proto2_Oneof()
389 var message = SampleMessages.CreateFullTestAllExtensions(); in GetExtensionValue()
392 …message.GetExtension(OptionalBoolExtension), Proto2.TestAllExtensions.Descriptor.FindFieldByNumber… in GetExtensionValue()
399 var message = new Proto2.TestAllExtensions(); in GetRepeatedExtensionValue()
401 Assert.IsNull(message.GetExtension(RepeatedBoolExtension)); in GetRepeatedExtensionValue()
402 …nsions.Descriptor.FindFieldByNumber(RepeatedBoolExtension.FieldNumber).Accessor.GetValue(message)); in GetRepeatedExtensionValue()
403 Assert.IsNotNull(message.GetExtension(RepeatedBoolExtension)); in GetRepeatedExtensionValue()
405 message.ClearExtension(RepeatedBoolExtension); in GetRepeatedExtensionValue()
406 Assert.IsNull(message.GetExtension(RepeatedBoolExtension)); in GetRepeatedExtensionValue()