File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
testproject/Assets/Tests/Runtime Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -89,5 +89,37 @@ public IEnumerator WhenSendingMessageFromClientToServer_SenderIdIsCorrect()
8989 Assert . IsTrue ( firstReceived ) ;
9090 Assert . IsTrue ( secondReceived ) ;
9191 }
92+
93+ [ UnityTest ]
94+ public IEnumerator WhenClientDisconnectsFromServer_ClientIdIsCorrect ( )
95+ {
96+ var firstClientId = FirstClient . LocalClientId ;
97+ bool received = false ;
98+ void firstCallback ( ulong id )
99+ {
100+ Assert . AreEqual ( firstClientId , id ) ;
101+ received = true ;
102+ }
103+ m_ServerNetworkManager . OnClientDisconnectCallback += firstCallback ;
104+ FirstClient . Shutdown ( ) ;
105+
106+ yield return new WaitForSeconds ( 0.2f ) ;
107+
108+ Assert . IsTrue ( received ) ;
109+ var secondClientId = SecondClient . LocalClientId ;
110+ received = false ;
111+
112+ m_ServerNetworkManager . OnClientDisconnectCallback -= firstCallback ;
113+ m_ServerNetworkManager . OnClientDisconnectCallback += id =>
114+ {
115+ Assert . AreEqual ( secondClientId , id ) ;
116+ received = true ;
117+ } ;
118+ SecondClient . Shutdown ( ) ;
119+
120+ yield return new WaitForSeconds ( 0.2f ) ;
121+
122+ Assert . IsTrue ( received ) ;
123+ }
92124 }
93125}
You can’t perform that action at this time.
0 commit comments