diff options
author | Jon Skeet <skeet@pobox.com> | 2009-01-16 10:57:40 +0000 |
---|---|---|
committer | Jon Skeet <skeet@pobox.com> | 2009-01-16 10:57:40 +0000 |
commit | 8f8186a30b9b8d865c6211eb91a4df8aae1f40d5 (patch) | |
tree | 8448e4c52607cd39f2035a06196cfe4247942f06 /src/ProtocolBuffers.Test/MessageUtilTest.cs | |
parent | 0c89aa1fdba0158d8dee3aef9cfe815afe4cc494 (diff) | |
download | protobuf-8f8186a30b9b8d865c6211eb91a4df8aae1f40d5.tar.gz protobuf-8f8186a30b9b8d865c6211eb91a4df8aae1f40d5.tar.bz2 protobuf-8f8186a30b9b8d865c6211eb91a4df8aae1f40d5.zip |
Benchmarking, dumping and munging
Diffstat (limited to 'src/ProtocolBuffers.Test/MessageUtilTest.cs')
-rw-r--r-- | src/ProtocolBuffers.Test/MessageUtilTest.cs | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/ProtocolBuffers.Test/MessageUtilTest.cs b/src/ProtocolBuffers.Test/MessageUtilTest.cs new file mode 100644 index 00000000..16495bf5 --- /dev/null +++ b/src/ProtocolBuffers.Test/MessageUtilTest.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Google.ProtocolBuffers.TestProtos; +using NUnit.Framework; + +namespace Google.ProtocolBuffers { + [TestFixture] + public class MessageUtilTest { + + [Test] + [ExpectedException(typeof(ArgumentNullException))] + public void NullTypeName() { + MessageUtil.GetDefaultMessage((string)null); + } + + [Test] + [ExpectedException(typeof(ArgumentException))] + public void InvalidTypeName() { + MessageUtil.GetDefaultMessage("invalidtypename"); + } + + [Test] + public void ValidTypeName() { + Assert.AreSame(TestAllTypes.DefaultInstance, MessageUtil.GetDefaultMessage(typeof(TestAllTypes).AssemblyQualifiedName)); + } + + [Test] + [ExpectedException(typeof(ArgumentNullException))] + public void NullType() { + MessageUtil.GetDefaultMessage((Type)null); + } + + [Test] + [ExpectedException(typeof(ArgumentException))] + public void NonMessageType() { + MessageUtil.GetDefaultMessage(typeof(string)); + } + + [Test] + public void ValidType() { + Assert.AreSame(TestAllTypes.DefaultInstance, MessageUtil.GetDefaultMessage(typeof(TestAllTypes))); + } + } +} |