-
-
Notifications
You must be signed in to change notification settings - Fork 65
Expand file tree
/
Copy pathIssue298.cs
More file actions
37 lines (30 loc) · 867 Bytes
/
Issue298.cs
File metadata and controls
37 lines (30 loc) · 867 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using System;
using System.Linq.Expressions;
using NUnit.Framework;
namespace DelegateDecompiler.Tests;
[TestFixture]
public class Issue298 : DecompilerTestsBase
{
[Test]
public void TestNotConstrained()
{
static int NotConstrained<T>(T value) where T : ITestInterface => ((ITestInterface)value).Value;
Expression<Func<TestClass, int>> expected = value => value.Value;
Test(NotConstrained, expected);
}
[Test]
public void TestConstrained()
{
static int Constrained<T>(T value) where T : ITestInterface => value.Value;
Expression<Func<TestClass, int>> expected = value => value.Value;
Test(Constrained, expected);
}
interface ITestInterface
{
public int Value { get; }
}
class TestClass : ITestInterface
{
public int Value { get; set; }
}
}