diff options
Diffstat (limited to 'tests/src/Loader/classloader/generics/GenericMethods/method011.cs')
-rw-r--r-- | tests/src/Loader/classloader/generics/GenericMethods/method011.cs | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/tests/src/Loader/classloader/generics/GenericMethods/method011.cs b/tests/src/Loader/classloader/generics/GenericMethods/method011.cs new file mode 100644 index 0000000000..6e579e2ab4 --- /dev/null +++ b/tests/src/Loader/classloader/generics/GenericMethods/method011.cs @@ -0,0 +1,58 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Threading; + +interface IFoo +{ + U Function<U>(U u); +} + +class Foo : IFoo +{ + public virtual U Function<U>(U u) + { + return u; + } + +} + +public class Test +{ + public static int counter = 0; + public static bool result = true; + public static void Eval(bool exp) + { + counter++; + if (!exp) + { + result = exp; + Console.WriteLine("Test Failed at location: " + counter); + } + + } + + public static int Main() + { + IFoo f = new Foo(); + + Eval(f.Function<int>(1).Equals(1)); + Eval(f.Function<string>("string").Equals("string")); + + + if (result) + { + Console.WriteLine("Test Passed"); + return 100; + } + else + { + Console.WriteLine("Test Failed"); + return 1; + } + + } +} + |