1010 */
1111
1212using System ;
13+ using System . Collections ;
1314using Microsoft . VisualStudio . TestTools . UnitTesting ;
1415
1516namespace CatLib . Tests
@@ -63,8 +64,32 @@ public void Register()
6364 }
6465 }
6566
67+ public class TestYieldProvider : ServiceProvider
68+ {
69+ public bool IsDone ;
70+ public override IEnumerator CoroutineInit ( )
71+ {
72+ IsDone = true ;
73+ yield return 1 ;
74+ yield return 2 ;
75+ yield return base . CoroutineInit ( ) ;
76+ }
77+ }
78+
6679 [ TestMethod ]
67- [ ExpectedException ( typeof ( RuntimeException ) ) ]
80+ public void TestYieldProviderTest ( )
81+ {
82+ var app = new Application ( ) ;
83+ app . Bootstrap ( ) ;
84+ var test = new TestYieldProvider ( ) ;
85+ app . Register ( test ) ;
86+ app . Init ( ) ;
87+
88+ Assert . AreEqual ( true , test . IsDone ) ;
89+ }
90+
91+ [ TestMethod ]
92+ [ ExpectedException ( typeof ( CodeStandardException ) ) ]
6893 public void RepeatInitTest ( )
6994 {
7095 var app = MakeApplication ( ) ;
@@ -171,12 +196,12 @@ public void TestStopRegisterProvider()
171196 }
172197
173198 [ TestMethod ]
174- [ ExpectedException ( typeof ( RuntimeException ) ) ]
199+ [ ExpectedException ( typeof ( CodeStandardException ) ) ]
175200 public void TestInitingRegisterProvider ( )
176201 {
177202 var application = Application . New ( ) ;
178203 application . Register ( new StopProvider ( ) ) ;
179- application . On < IServiceProvider > ( ApplicationEvents . OnIniting , ( b ) =>
204+ application . On < IServiceProvider > ( ApplicationEvents . OnProviderInit , ( b ) =>
180205 {
181206 application . Register ( new TestServiceProvider ( ) ) ;
182207 } ) ;
@@ -185,7 +210,7 @@ public void TestInitingRegisterProvider()
185210 }
186211
187212 [ TestMethod ]
188- [ ExpectedException ( typeof ( RuntimeException ) ) ]
213+ [ ExpectedException ( typeof ( CodeStandardException ) ) ]
189214 public void TestTerminateRegisterProvider ( )
190215 {
191216 var application = Application . New ( ) ;
@@ -263,15 +288,15 @@ public void GetCurrentProcess()
263288 [ TestMethod ]
264289 public void TestDebugLevel ( )
265290 {
266- App . DebugLevel = DebugLevels . Dev ;
267- Assert . AreEqual ( DebugLevels . Dev , App . DebugLevel ) ;
291+ App . DebugLevel = DebugLevels . Development ;
292+ Assert . AreEqual ( DebugLevels . Development , App . DebugLevel ) ;
268293 }
269294
270295 /// <summary>
271296 /// 重复的引导测试
272297 /// </summary>
273298 [ TestMethod ]
274- [ ExpectedException ( typeof ( RuntimeException ) ) ]
299+ [ ExpectedException ( typeof ( CodeStandardException ) ) ]
275300 public void RepeatBootstrap ( )
276301 {
277302 var app = new Application ( ) ;
@@ -441,6 +466,22 @@ public void TestIsMainThread()
441466 Assert . AreEqual ( true , app . IsMainThread ) ;
442467 }
443468
469+ public class TestRegisterProcessMakeServiceProvider : ServiceProvider
470+ {
471+ public override void Register ( )
472+ {
473+ App . Make < object > ( ) ;
474+ }
475+ }
476+
477+ [ TestMethod ]
478+ [ ExpectedException ( typeof ( CodeStandardException ) ) ]
479+ public void TestRegisterProcessMake ( )
480+ {
481+ var app = MakeApplication ( ) ;
482+ app . Register ( new TestRegisterProcessMakeServiceProvider ( ) ) ;
483+ }
484+
444485 private Application MakeApplication ( )
445486 {
446487 var app = new Application ( ) ;
0 commit comments