Added test for Delegate.CreateDelegate method (dotnet/corefx#25528)
authorVictor Zaytsev <allisq3@gmail.com>
Tue, 5 Dec 2017 17:09:39 +0000 (20:09 +0300)
committerStephen Toub <stoub@microsoft.com>
Tue, 5 Dec 2017 17:09:39 +0000 (12:09 -0500)
* Added test for Delegate.CreateDelegate method

* Ignored test for netfx.

Commit migrated from https://github.com/dotnet/corefx/commit/1922cb233910536604812c5f840060e1702a0908

src/libraries/System.Runtime/tests/System/DelegateTests.cs

index 840402c..39314a9 100644 (file)
@@ -682,6 +682,16 @@ namespace System.Tests
         }
 
         [Fact]
+        [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "dotnet/coreclr#15196")]
+        public static void CreateDelegate2_Target_GenericTypeParameter()
+        {
+
+            Type theT = typeof(G<>).GetTypeInfo().GenericTypeParameters[0];
+            Type delegateType = typeof(Func<object, object, bool>);
+            AssertExtensions.Throws<ArgumentException>("target", () => Delegate.CreateDelegate(delegateType, theT, "ReferenceEquals"));
+        }
+
+        [Fact]
         public static void CreateDelegate2_Type_Null()
         {
             C c = new C();