File tree 1 file changed +24
-0
lines changed
1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change 1
1
using System ;
2
+ using System . Runtime . CompilerServices ;
2
3
using Moq ;
3
4
using Unity ;
4
5
using Unity . Exceptions ;
5
6
using Unity . Injection ;
6
7
using Unity . Lifetime ;
7
8
using Xunit ;
8
9
10
+ [ assembly: InternalsVisibleTo ( "LazyProxy.DynamicTypes" ) ]
11
+
9
12
namespace LazyProxy . Unity . Tests
10
13
{
11
14
public class UnityExtensionTests
@@ -57,6 +60,16 @@ public Service2()
57
60
public string Method ( string arg ) => "service2->" + arg ;
58
61
}
59
62
63
+ internal interface IInternalService
64
+ {
65
+ string Get ( ) ;
66
+ }
67
+
68
+ internal class InternalService : IInternalService
69
+ {
70
+ public string Get ( ) => "InternalService" ;
71
+ }
72
+
60
73
[ Fact ]
61
74
public void ServiceCtorMustBeExecutedAfterMethodIsCalledAndOnlyOnce ( )
62
75
{
@@ -281,5 +294,16 @@ public void RegistrationMustThrowAnExceptionForNonInterfaces()
281
294
{
282
295
Assert . Throws < NotSupportedException > ( ( ) => new UnityContainer ( ) . RegisterLazy < Service1 , Service1 > ( ) ) ;
283
296
}
297
+
298
+ [ Fact ]
299
+ public void InternalsVisibleToAttributeMustAllowToResolveInternalServices ( )
300
+ {
301
+ var result = new UnityContainer ( )
302
+ . RegisterLazy < IInternalService , InternalService > ( )
303
+ . Resolve < IInternalService > ( )
304
+ . Get ( ) ;
305
+
306
+ Assert . Equal ( "InternalService" , result ) ;
307
+ }
284
308
}
285
309
}
You can’t perform that action at this time.
0 commit comments