@@ -51,7 +51,7 @@ public void Test03_CreateMixedRealityOrchestrator()
5151
5252 // Create Test Configuration
5353 Assert . AreEqual ( 0 , MixedRealityToolkit . Instance . ActiveProfile . ActiveServices . Count ) ;
54- Assert . AreEqual ( 3 , MixedRealityToolkit . Instance . MixedRealityComponents . Count ) ;
54+ Assert . AreEqual ( 0 , MixedRealityToolkit . Instance . MixedRealityComponents . Count ) ;
5555 }
5656
5757 [ Test ]
@@ -66,7 +66,7 @@ public void Test04_CreateMixedRealityInputSystem()
6666 Assert . IsNotNull ( MixedRealityToolkit . Instance . ActiveProfile ) ;
6767 Assert . IsNotEmpty ( MixedRealityToolkit . Instance . ActiveProfile . ActiveServices ) ;
6868 Assert . AreEqual ( 1 , MixedRealityToolkit . Instance . ActiveProfile . ActiveServices . Count ) ;
69- Assert . AreEqual ( 3 , MixedRealityToolkit . Instance . MixedRealityComponents . Count ) ;
69+ Assert . AreEqual ( 0 , MixedRealityToolkit . Instance . MixedRealityComponents . Count ) ;
7070 }
7171
7272 [ Test ]
@@ -117,16 +117,14 @@ public void Test08_CreateMixedRealityComponent()
117117 {
118118 InitializeMixedRealityToolkitScene ( ) ;
119119
120- var component = new TestComponent1 ( ) ;
121-
122120 // Add Input System
123121 MixedRealityToolkit . Instance . RegisterService ( typeof ( IMixedRealityInputSystem ) , new MixedRealityInputManager ( ) ) ;
124122
125123 // Add test component
126- MixedRealityToolkit . Instance . RegisterService ( typeof ( ITestComponent1 ) , component ) ;
124+ MixedRealityToolkit . Instance . RegisterService ( typeof ( ITestComponent1 ) , new TestComponent1 ( ) ) ;
127125
128126 // Tests
129- Assert . AreEqual ( 4 , MixedRealityToolkit . Instance . MixedRealityComponents . Count ) ;
127+ Assert . AreEqual ( 1 , MixedRealityToolkit . Instance . MixedRealityComponents . Count ) ;
130128 }
131129
132130 [ Test ]
@@ -157,14 +155,15 @@ public void Test10_TestMixedRealityComponents()
157155
158156 // Add test component
159157 MixedRealityToolkit . Instance . RegisterService ( typeof ( ITestComponent1 ) , new TestComponent1 ( ) ) ;
160- MixedRealityToolkit . Instance . RegisterService ( typeof ( ITestComponent1 ) , new TestComponent1 ( ) ) ;
161- MixedRealityToolkit . Instance . RegisterService ( typeof ( ITestComponent1 ) , new TestComponent1 ( ) ) ;
158+ MixedRealityToolkit . Instance . RegisterService ( typeof ( ITestComponent2 ) , new TestComponent2 ( ) ) ;
159+ MixedRealityToolkit . Instance . RegisterService ( typeof ( IFailComponent ) , new TestFailComponent ( ) ) ;
160+ LogAssert . Expect ( LogType . Error , $ "Unable to register { typeof ( IFailComponent ) } . Concrete type does not implement the IMixedRealityExtensionService implementation.") ;
162161
163- // Retrieve Component1
164- var components = MixedRealityToolkit . Instance . GetActiveServices ( typeof ( ITestComponent1 ) ) ;
162+ // Retrieve all registered IMixedRealityExtensionServices
163+ var components = MixedRealityToolkit . Instance . GetActiveServices ( typeof ( IMixedRealityExtensionService ) ) ;
165164
166165 // Tests
167- Assert . AreEqual ( 3 , components . Count ) ;
166+ Assert . AreEqual ( 2 , components . Count ) ;
168167 }
169168
170169 [ Test ]
@@ -178,16 +177,9 @@ public void Test11_TestMixedRealityComponent2DoesNotReturn()
178177 // Add test component
179178 MixedRealityToolkit . Instance . RegisterService ( typeof ( ITestComponent1 ) , new TestComponent1 ( ) ) ;
180179
181- try
182- {
183- // Validate non-existent component
184- MixedRealityToolkit . Instance . GetService ( typeof ( ITestComponent2 ) , "Test2" ) ;
185- Assert . Fail ( ) ;
186- }
187- catch ( Exception )
188- {
189- // ignored
190- }
180+ // Validate non-existent component
181+ MixedRealityToolkit . Instance . GetService ( typeof ( ITestComponent2 ) , "Test2" ) ;
182+ LogAssert . Expect ( LogType . Error , "Unable to find Test2 Manager." ) ;
191183 }
192184
193185 [ Test ]
@@ -226,7 +218,7 @@ public void Test13_CreateMixedRealityComponentNameWithInput()
226218 Assert . IsNotNull ( MixedRealityToolkit . Instance . ActiveProfile ) ;
227219 Assert . IsNotEmpty ( MixedRealityToolkit . Instance . ActiveProfile . ActiveServices ) ;
228220 Assert . AreEqual ( 1 , MixedRealityToolkit . Instance . ActiveProfile . ActiveServices . Count ) ;
229- Assert . AreEqual ( 5 , MixedRealityToolkit . Instance . MixedRealityComponents . Count ) ;
221+ Assert . AreEqual ( 2 , MixedRealityToolkit . Instance . MixedRealityComponents . Count ) ;
230222 }
231223
232224 [ Test ]
@@ -300,7 +292,7 @@ public void Test16_GetAllMixedRealityComponents()
300292 var allComponents = MixedRealityToolkit . Instance . MixedRealityComponents ;
301293
302294 // Tests
303- Assert . AreEqual ( 7 , allComponents . Count ) ;
295+ Assert . AreEqual ( 4 , allComponents . Count ) ;
304296 }
305297
306298 [ Test ]
@@ -334,9 +326,9 @@ private static void InitializeMixedRealityToolkitScene()
334326
335327 #region Test Components
336328
337- public interface ITestComponent1 : IMixedRealityService { }
329+ public interface ITestComponent1 : IMixedRealityExtensionService { }
338330
339- public interface ITestComponent2 : IMixedRealityService { }
331+ public interface ITestComponent2 : IMixedRealityExtensionService { }
340332
341333 internal class TestComponent1 : BaseService , ITestComponent1
342334 {
@@ -350,30 +342,6 @@ public override void Initialize()
350342 {
351343 InputSystem = MixedRealityToolkit . Instance . GetService < IMixedRealityInputSystem > ( ) ;
352344 }
353-
354- /// <summary>
355- /// Optional Update function to perform per-frame updates of the service
356- /// </summary>
357- public override void Update ( )
358- {
359- // TODO Update stuff
360- }
361-
362- /// <summary>
363- /// Optional ProfileUpdate function to allow reconfiguration when the active configuration profile of the Mixed Reality Toolkit is replaced
364- /// </summary>
365- public override void Reset ( )
366- {
367- // TODO React to profile change
368- }
369-
370- /// <summary>
371- /// Optional Destroy function to perform cleanup of the service before the Mixed Reality Toolkit is destroyed
372- /// </summary>
373- public override void Destroy ( )
374- {
375- // TODO Destroy stuff
376- }
377345 }
378346
379347 internal class TestComponent2 : BaseService , ITestComponent2
@@ -388,31 +356,11 @@ public override void Initialize()
388356 {
389357 InputSystem = MixedRealityToolkit . Instance . GetService < IMixedRealityInputSystem > ( ) ;
390358 }
359+ }
391360
392- /// <summary>
393- /// Optional Update function to perform per-frame updates of the service
394- /// </summary>
395- public override void Update ( )
396- {
397- // TODO Update stuff
398- }
399-
400- /// <summary>
401- /// Optional ProfileUpdate function to allow reconfiguration when the active configuration profile of the Mixed Reality Toolkit is replaced
402- /// </summary>
403- public override void Reset ( )
404- {
405- // TODO React to profile change
406- }
361+ internal interface IFailComponent : IMixedRealityService { }
407362
408- /// <summary>
409- /// Optional Destroy function to perform cleanup of the service before the Mixed Reality Toolkit is destroyed
410- /// </summary>
411- public override void Destroy ( )
412- {
413- // TODO Destroy stuff
414- }
415- }
363+ internal class TestFailComponent : BaseService , IFailComponent { }
416364
417365 #endregion Test Components
418366}
0 commit comments