1+ using System . Text . RegularExpressions ;
12using NUnit . Framework ;
23using UnityEngine ;
34using UnityEngine . TestTools ;
@@ -31,19 +32,17 @@ public void NetworkManagerOverrideTest()
3132 }
3233
3334 [ Test ]
34- public void GetBehaviourIndexNone ( )
35+ [ TestCase ( 0 ) ]
36+ [ TestCase ( 1 ) ]
37+ [ TestCase ( 2 ) ]
38+ public void GetBehaviourIndexNone ( int index )
3539 {
3640 var gameObject = new GameObject ( nameof ( GetBehaviourIndexNone ) ) ;
3741 var networkObject = gameObject . AddComponent < NetworkObject > ( ) ;
3842
39- // TODO: Maybe not hardcode message?
40- LogAssert . Expect ( LogType . Error , $ "[Netcode] Behaviour index was out of bounds. Did you mess up the order of your { nameof ( NetworkBehaviour ) } s?") ;
41- LogAssert . Expect ( LogType . Error , $ "[Netcode] Behaviour index was out of bounds. Did you mess up the order of your { nameof ( NetworkBehaviour ) } s?") ;
42- LogAssert . Expect ( LogType . Error , $ "[Netcode] Behaviour index was out of bounds. Did you mess up the order of your { nameof ( NetworkBehaviour ) } s?") ;
43+ LogAssert . Expect ( LogType . Error , new Regex ( ".*out of bounds.*" ) ) ;
4344
44- Assert . That ( networkObject . GetNetworkBehaviourAtOrderIndex ( 0 ) , Is . Null ) ;
45- Assert . That ( networkObject . GetNetworkBehaviourAtOrderIndex ( 1 ) , Is . Null ) ;
46- Assert . That ( networkObject . GetNetworkBehaviourAtOrderIndex ( 2 ) , Is . Null ) ;
45+ Assert . That ( networkObject . GetNetworkBehaviourAtOrderIndex ( ( ushort ) index ) , Is . Null ) ;
4746
4847 // Cleanup
4948 Object . DestroyImmediate ( gameObject ) ;
@@ -56,13 +55,10 @@ public void GetBehaviourIndexOne()
5655 var networkObject = gameObject . AddComponent < NetworkObject > ( ) ;
5756 var networkBehaviour = gameObject . AddComponent < EmptyNetworkBehaviour > ( ) ;
5857
59- // TODO: Maybe not hardcode message?
60- LogAssert . Expect ( LogType . Error , $ "[Netcode] Behaviour index was out of bounds. Did you mess up the order of your { nameof ( NetworkBehaviour ) } s?") ;
61- LogAssert . Expect ( LogType . Error , $ "[Netcode] Behaviour index was out of bounds. Did you mess up the order of your { nameof ( NetworkBehaviour ) } s?") ;
58+ LogAssert . Expect ( LogType . Error , new Regex ( ".*out of bounds.*" ) ) ;
6259
6360 Assert . That ( networkObject . GetNetworkBehaviourAtOrderIndex ( 0 ) , Is . EqualTo ( networkBehaviour ) ) ;
6461 Assert . That ( networkObject . GetNetworkBehaviourAtOrderIndex ( 1 ) , Is . Null ) ;
65- Assert . That ( networkObject . GetNetworkBehaviourAtOrderIndex ( 2 ) , Is . Null ) ;
6662
6763 // Cleanup
6864 Object . DestroyImmediate ( gameObject ) ;
0 commit comments