OLD | NEW |
1 #region Copyright notice and license | 1 #region Copyright notice and license |
2 // Protocol Buffers - Google's data interchange format | 2 // Protocol Buffers - Google's data interchange format |
3 // Copyright 2008 Google Inc. All rights reserved. | 3 // Copyright 2008 Google Inc. All rights reserved. |
4 // https://developers.google.com/protocol-buffers/ | 4 // https://developers.google.com/protocol-buffers/ |
5 // | 5 // |
6 // Redistribution and use in source and binary forms, with or without | 6 // Redistribution and use in source and binary forms, with or without |
7 // modification, are permitted provided that the following conditions are | 7 // modification, are permitted provided that the following conditions are |
8 // met: | 8 // met: |
9 // | 9 // |
10 // * Redistributions of source code must retain the above copyright | 10 // * Redistributions of source code must retain the above copyright |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 Assert.AreEqual("NestedEnum", nestedType.Name); | 188 Assert.AreEqual("NestedEnum", nestedType.Name); |
189 Assert.AreEqual("protobuf_unittest.TestAllTypes.NestedEnum", | 189 Assert.AreEqual("protobuf_unittest.TestAllTypes.NestedEnum", |
190 nestedType.FullName); | 190 nestedType.FullName); |
191 Assert.AreEqual(UnittestProto3Reflection.Descriptor, nestedType.File
); | 191 Assert.AreEqual(UnittestProto3Reflection.Descriptor, nestedType.File
); |
192 Assert.AreEqual(TestAllTypes.Descriptor, nestedType.ContainingType); | 192 Assert.AreEqual(TestAllTypes.Descriptor, nestedType.ContainingType); |
193 | 193 |
194 EnumValueDescriptor value = enumType.FindValueByName("FOREIGN_FOO"); | 194 EnumValueDescriptor value = enumType.FindValueByName("FOREIGN_FOO"); |
195 Assert.AreEqual(value, enumType.Values[1]); | 195 Assert.AreEqual(value, enumType.Values[1]); |
196 Assert.AreEqual("FOREIGN_FOO", value.Name); | 196 Assert.AreEqual("FOREIGN_FOO", value.Name); |
197 Assert.AreEqual(4, value.Number); | 197 Assert.AreEqual(4, value.Number); |
198 Assert.AreEqual((int) ForeignEnum.FOREIGN_FOO, value.Number); | 198 Assert.AreEqual((int) ForeignEnum.ForeignFoo, value.Number); |
199 Assert.AreEqual(value, enumType.FindValueByNumber(4)); | 199 Assert.AreEqual(value, enumType.FindValueByNumber(4)); |
200 Assert.Null(enumType.FindValueByName("NO_SUCH_VALUE")); | 200 Assert.Null(enumType.FindValueByName("NO_SUCH_VALUE")); |
201 for (int i = 0; i < enumType.Values.Count; i++) | 201 for (int i = 0; i < enumType.Values.Count; i++) |
202 { | 202 { |
203 Assert.AreEqual(i, enumType.Values[i].Index); | 203 Assert.AreEqual(i, enumType.Values[i].Index); |
204 } | 204 } |
205 } | 205 } |
206 | 206 |
207 [Test] | 207 [Test] |
208 public void OneofDescriptor() | 208 public void OneofDescriptor() |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 | 250 |
251 | 251 |
252 [Test] | 252 [Test] |
253 public void DescriptorProtoFileDescriptor() | 253 public void DescriptorProtoFileDescriptor() |
254 { | 254 { |
255 var descriptor = Google.Protobuf.Reflection.FileDescriptor.Descripto
rProtoFileDescriptor; | 255 var descriptor = Google.Protobuf.Reflection.FileDescriptor.Descripto
rProtoFileDescriptor; |
256 Assert.AreEqual("google/protobuf/descriptor.proto", descriptor.Name)
; | 256 Assert.AreEqual("google/protobuf/descriptor.proto", descriptor.Name)
; |
257 } | 257 } |
258 } | 258 } |
259 } | 259 } |
OLD | NEW |