1
1
using System ;
2
2
using System . Collections ;
3
- using System . Collections . Generic ;
4
3
using UnityEngine ;
5
4
using UnityEngine . TestTools ;
6
5
using NUnit . Framework ;
@@ -101,6 +100,7 @@ public override IEnumerator Setup()
101
100
102
101
// This is the *SERVER VERSION* of the *CLIENT PLAYER*
103
102
var serverClientPlayerResult = new MultiInstanceHelpers . CoroutineResultWrapper < NetworkObject > ( ) ;
103
+
104
104
yield return MultiInstanceHelpers . Run ( MultiInstanceHelpers . GetNetworkObjectByRepresentation (
105
105
x => x . IsPlayerObject && x . OwnerClientId == m_ClientNetworkManagers [ 0 ] . LocalClientId ,
106
106
m_ServerNetworkManager , serverClientPlayerResult ) ) ;
@@ -118,14 +118,16 @@ public override IEnumerator Setup()
118
118
m_ClientComp = clientSideClientPlayer . GetComponent < NetworkVariableTest > ( ) ;
119
119
120
120
m_ServerComp . TheList . Clear ( ) ;
121
+ m_ServerComp . TheSet . Clear ( ) ;
122
+ m_ServerComp . TheDictionary . Clear ( ) ;
121
123
122
- if ( m_ServerComp . TheList . Count > 0 )
124
+ if ( m_ServerComp . TheList . Count > 0 || m_ServerComp . TheSet . Count > 0 || m_ServerComp . TheDictionary . Count > 0 )
123
125
{
124
- throw new Exception ( "server network list not empty at start" ) ;
126
+ throw new Exception ( "at least one server network container not empty at start" ) ;
125
127
}
126
- if ( m_ClientComp . TheList . Count > 0 )
128
+ if ( m_ClientComp . TheList . Count > 0 || m_ClientComp . TheSet . Count > 0 || m_ClientComp . TheDictionary . Count > 0 )
127
129
{
128
- throw new Exception ( "client network list not empty at start" ) ;
130
+ throw new Exception ( "at least one client network container not empty at start" ) ;
129
131
}
130
132
}
131
133
@@ -178,8 +180,6 @@ public IEnumerator AllNetworkVariableTypes()
178
180
[ UnityTest ]
179
181
public IEnumerator NetworkListAdd ( )
180
182
{
181
- var waitResult = new MultiInstanceHelpers . CoroutineResultWrapper < bool > ( ) ;
182
-
183
183
yield return MultiInstanceHelpers . RunAndWaitForCondition (
184
184
( ) =>
185
185
{
@@ -245,9 +245,8 @@ public IEnumerator NetworkSetAdd()
245
245
yield return MultiInstanceHelpers . RunAndWaitForCondition (
246
246
( ) =>
247
247
{
248
- ISet < int > iSet = m_ServerComp . TheSet ;
249
- iSet . Add ( k_TestVal1 ) ;
250
- iSet . Add ( k_TestVal2 ) ;
248
+ m_ServerComp . TheSet . Add ( k_TestVal1 ) ;
249
+ m_ServerComp . TheSet . Add ( k_TestVal2 ) ;
251
250
} ,
252
251
( ) =>
253
252
{
@@ -272,8 +271,7 @@ public IEnumerator NetworkSetRemove()
272
271
yield return MultiInstanceHelpers . RunAndWaitForCondition (
273
272
( ) =>
274
273
{
275
- ISet < int > iSet = m_ServerComp . TheSet ;
276
- iSet . Remove ( k_TestVal1 ) ;
274
+ m_ServerComp . TheSet . Remove ( k_TestVal1 ) ;
277
275
} ,
278
276
( ) =>
279
277
{
@@ -296,8 +294,7 @@ public IEnumerator NetworkSetClear()
296
294
yield return MultiInstanceHelpers . RunAndWaitForCondition (
297
295
( ) =>
298
296
{
299
- ISet < int > iSet = m_ServerComp . TheSet ;
300
- iSet . Clear ( ) ;
297
+ m_ServerComp . TheSet . Clear ( ) ;
301
298
} ,
302
299
( ) =>
303
300
{
0 commit comments