aboutsummaryrefslogtreecommitdiff
path: root/src/ProtocolBuffers.Test/IssuesTest.cs
diff options
context:
space:
mode:
authorJon Skeet <skeet@pobox.com>2012-06-04 10:35:59 +0100
committerJon Skeet <skeet@pobox.com>2012-06-04 10:35:59 +0100
commit34378b49b5b7a2cac2305cd32a041b3ec29c66f8 (patch)
tree9bdf556de3b97fcb855c30e7788fdc8ef9a4f02f /src/ProtocolBuffers.Test/IssuesTest.cs
parent8f0dcf3df1548a1eff0bed54a9b992f55b8f72d5 (diff)
downloadprotobuf-34378b49b5b7a2cac2305cd32a041b3ec29c66f8.tar.gz
protobuf-34378b49b5b7a2cac2305cd32a041b3ec29c66f8.tar.bz2
protobuf-34378b49b5b7a2cac2305cd32a041b3ec29c66f8.zip
Test and fix for issue 45. When we fetch properties, explicitly state that
we don't want any arguments, to avoid ambiguity with indexers. (Also, change a few "typeof (Foo)" to "typeof(Foo)". Fuller replacement coming.)
Diffstat (limited to 'src/ProtocolBuffers.Test/IssuesTest.cs')
-rw-r--r--src/ProtocolBuffers.Test/IssuesTest.cs59
1 files changed, 59 insertions, 0 deletions
diff --git a/src/ProtocolBuffers.Test/IssuesTest.cs b/src/ProtocolBuffers.Test/IssuesTest.cs
new file mode 100644
index 00000000..7096a52d
--- /dev/null
+++ b/src/ProtocolBuffers.Test/IssuesTest.cs
@@ -0,0 +1,59 @@
+#region Copyright notice and license
+
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc. All rights reserved.
+// http://github.com/jskeet/dotnet-protobufs/
+// Original C++/Java/Python code:
+// http://code.google.com/p/protobuf/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#endregion
+
+using Google.ProtocolBuffers.Descriptors;
+using NUnit.Framework;
+using UnitTest.Issues.TestProtos;
+
+namespace Google.ProtocolBuffers
+{
+ /// <summary>
+ /// Tests for issues which aren't easily compartmentalized into other unit tests.
+ /// </summary>
+ [TestFixture]
+ public class IssuesTest
+ {
+ // Issue 45
+ [Test]
+ public void FieldCalledItem()
+ {
+ ItemField message = new ItemField.Builder { Item = 3 }.Build();
+ FieldDescriptor field = ItemField.Descriptor.FindFieldByName("item");
+ Assert.IsNotNull(field);
+ Assert.AreEqual(3, message[field]);
+ }
+ }
+}