|
|
|
@ -34,6 +34,7 @@ using System; |
|
|
|
|
using System.Collections.Generic; |
|
|
|
|
using System.Reflection; |
|
|
|
|
|
|
|
|
|
#if !DOTNET35 |
|
|
|
|
namespace Google.Protobuf.Compatibility |
|
|
|
|
{ |
|
|
|
|
public class TypeExtensionsTest |
|
|
|
@ -50,24 +51,6 @@ namespace Google.Protobuf.Compatibility |
|
|
|
|
{ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
[Test] |
|
|
|
|
[TestCase(typeof(int), true)] |
|
|
|
|
[TestCase(typeof(int?), true)] |
|
|
|
|
[TestCase(typeof(Nullable<>), true)] |
|
|
|
|
[TestCase(typeof(WireFormat.WireType), true)] |
|
|
|
|
[TestCase(typeof(string), false)] |
|
|
|
|
[TestCase(typeof(object), false)] |
|
|
|
|
[TestCase(typeof(Enum), false)] |
|
|
|
|
[TestCase(typeof(ValueType), false)] |
|
|
|
|
[TestCase(typeof(TypeExtensionsTest), false)] |
|
|
|
|
[TestCase(typeof(Action), false)] |
|
|
|
|
[TestCase(typeof(Action<>), false)] |
|
|
|
|
[TestCase(typeof(IDisposable), false)] |
|
|
|
|
public void IsValueType(Type type, bool expected) |
|
|
|
|
{ |
|
|
|
|
Assert.AreEqual(expected, TypeExtensions.IsValueType(type)); |
|
|
|
|
} |
|
|
|
|
#if !DOTNET35 |
|
|
|
|
[Test] |
|
|
|
|
[TestCase(typeof(object), typeof(string), true)] |
|
|
|
|
[TestCase(typeof(object), typeof(int), true)] |
|
|
|
@ -129,6 +112,6 @@ namespace Google.Protobuf.Compatibility |
|
|
|
|
{ |
|
|
|
|
Assert.Throws<AmbiguousMatchException>(() => TypeExtensions.GetMethod(type, name)); |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|