File tree Expand file tree Collapse file tree
src/UnityContainerAttributeRegistrationTest Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1717
1818namespace UnityContainerAttributeRegistrationTest . Attribute
1919{
20- internal class RegisterTypeAttributeTest
20+ internal class RegisterTypeAttributeTest : TestBase
2121 {
2222 [ Test ]
2323 [ TestCase ( typeof ( Default ) ,
@@ -100,25 +100,5 @@ public void TestPopulate_WithCustomContainer()
100100
101101 AreSame ( container , result ) ;
102102 }
103-
104- private bool IsUnityContainerRegistration ( IContainerRegistration registration )
105- {
106- bool registeredType = registration . RegisteredType == typeof ( IUnityContainer ) ;
107- bool mappedToType = registration . MappedToType == typeof ( UnityContainer ) ;
108-
109- return registeredType && mappedToType ;
110- }
111-
112- private bool IsExpectedRegisteredContainer ( IContainerRegistration registration ,
113- Type expectedFrom ,
114- Type expectedTo ,
115- Type expectedTypeLifetimeManagerType )
116- {
117- bool registeredType = registration . RegisteredType == expectedFrom ;
118- bool mappedToType = registration . MappedToType == expectedTo ;
119- bool lifetimeManager = registration . LifetimeManager . GetType ( ) == expectedTypeLifetimeManagerType ;
120-
121- return registeredType && mappedToType && lifetimeManager ;
122- }
123103 }
124104}
Original file line number Diff line number Diff line change 1+ using System ;
2+
3+ using Unity ;
4+
5+
6+ namespace UnityContainerAttributeRegistrationTest . Helper
7+ {
8+ public abstract class TestBase
9+ {
10+ protected bool IsUnityContainerRegistration ( IContainerRegistration registration )
11+ {
12+ bool registeredType = registration . RegisteredType == typeof ( IUnityContainer ) ;
13+ bool mappedToType = registration . MappedToType == typeof ( UnityContainer ) ;
14+
15+ return registeredType && mappedToType ;
16+ }
17+
18+ protected bool IsExpectedRegisteredContainer ( IContainerRegistration registration ,
19+ Type expectedFrom ,
20+ Type expectedTo ,
21+ Type expectedTypeLifetimeManagerType )
22+ {
23+ bool registeredType = registration . RegisteredType == expectedFrom ;
24+ bool mappedToType = registration . MappedToType == expectedTo ;
25+ bool lifetimeManager = registration . LifetimeManager . GetType ( ) == expectedTypeLifetimeManagerType ;
26+
27+ return registeredType && mappedToType && lifetimeManager ;
28+ }
29+ }
30+ }
You can’t perform that action at this time.
0 commit comments