Skip to content

Commit 7e57902

Browse files
authored
Update Issues.cs
1 parent 52fb1fb commit 7e57902

1 file changed

Lines changed: 44 additions & 1 deletion

File tree

tests/Issues.cs

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,55 @@
77
using Unity.Interception.ContainerIntegration;
88
using Unity.Lifetime;
99
using System.Diagnostics;
10+
using Unity;
11+
using Unity.Interception;
1012

11-
namespace Unity.Interception.Tests
13+
namespace UnityInterception.Tests
1214
{
1315
[TestClass]
1416
public class Issues
1517
{
18+
19+
[TestMethod]
20+
public void unitycontainer_unity_45()
21+
{
22+
var proxy = Intercept.ThroughProxy<IInterface<string, string>>(
23+
new Thing(),
24+
new InterfaceInterceptor(),
25+
new[] { new TestInterceptor() });
26+
27+
proxy.DoSomething("hello world");
28+
}
29+
30+
public interface IInterface<in TIn, out TOut>
31+
{
32+
TOut DoSomething(TIn input);
33+
}
34+
35+
public class Thing : IInterface<string, string>
36+
{
37+
public string DoSomething(string input)
38+
{
39+
return input;
40+
}
41+
}
42+
43+
public class TestInterceptor : IInterceptionBehavior
44+
{
45+
public bool WillExecute => true;
46+
47+
public IEnumerable<Type> GetRequiredInterfaces()
48+
{
49+
return Type.EmptyTypes;
50+
}
51+
52+
public IMethodReturn Invoke(IMethodInvocation input, GetNextInterceptionBehaviorDelegate getNext)
53+
{
54+
return getNext()(input, null);
55+
}
56+
}
57+
58+
1659
[TestMethod]
1760
public void unitycontainer_interception_162()
1861
{

0 commit comments

Comments
 (0)