forked from dotnetcore/AspectCore-Framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMethodSignatureTest.cs
More file actions
65 lines (57 loc) · 2.04 KB
/
Copy pathMethodSignatureTest.cs
File metadata and controls
65 lines (57 loc) · 2.04 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
using System;
using System.Collections.Generic;
using System.Text;
using Xunit;
using System.Reflection;
namespace AspectCore.Extensions.Reflection.Test
{
public class MethodSignatureTest
{
[Fact]
public void Verification()
{
Assert.Equal(
new MethodSignature(typeof(BaseClass).GetMethod("Test1")),
new MethodSignature(typeof(BaseClass).GetMethod("Test1")));
Assert.Equal(
new MethodSignature(typeof(BaseClass).GetMethod("Test2")),
new MethodSignature(typeof(BaseClass).GetMethod("Test2")));
Assert.Equal(
new MethodSignature(typeof(BaseClass).GetMethod("Test3")),
new MethodSignature(typeof(BaseClass).GetMethod("Test3")));
Assert.NotEqual(
new MethodSignature(typeof(BaseClass).GetMethod("Test1")),
new MethodSignature(typeof(BaseClass).GetMethod("Test2")));
Assert.Equal(
new MethodSignature(typeof(BaseClass).GetMethod("Test1")),
new MethodSignature(typeof(SubClass).GetMethod("Test1")));
Assert.Equal(
new MethodSignature(typeof(BaseClass).GetMethod("Test2")),
new MethodSignature(typeof(SubClass).GetMethod("Test2")));
Assert.Equal(
new MethodSignature(typeof(BaseClass).GetMethod("Test3")),
new MethodSignature(typeof(SubClass).GetMethod("Test3")));
}
}
public class BaseClass
{
public virtual string Test1(string value) { return value; }
public virtual T Test2<T>(T value) { return value; }
public virtual void Test3<T, V>() { }
}
public class SubClass : BaseClass
{
public override string Test1(string value)
{
return base.Test1(value);
}
public override T Test2<T>(T value)
{
return base.Test2(value);
}
public override void Test3<T, V>()
{
base.Test3<T, V>();
}
}
}