Exemplo n.º 1
0
        public void ServerLookupDoesNotAccumulateDuplicates()
        {
            var msg = new ClientMsgProtobuf <CMsgClientServerList>(EMsg.ClientServerList);

            msg.Body.servers.Add(new CMsgClientServerList.Server
            {
                server_type = ( int )EServerType.CM,
                server_ip   = 0x7F000001, // 127.0.0.1
                server_port = 1234
            });

            var client = new DummyCMClient();

            client.HandleClientMsg(msg);
            Assert.Equal(1, client.GetServersOfType(EServerType.CM).Count);

            client.HandleClientMsg(msg);
            Assert.Equal(1, client.GetServersOfType(EServerType.CM).Count);
        }
Exemplo n.º 2
0
        public void ServerLookupIsClearedWhenDisconnecting()
        {
            var msg = new ClientMsgProtobuf<CMsgClientServerList>( EMsg.ClientServerList );
            msg.Body.servers.Add( new CMsgClientServerList.Server
            {
                server_type = ( int )EServerType.CM,
                server_ip = 0x7F000001, // 127.0.0.1
                server_port = 1234
            });

            var client = new DummyCMClient();
            client.HandleClientMsg( msg );

            Assert.Equal( 1, client.GetServersOfType( EServerType.CM ).Count );

            client.DummyDisconnect();
            Assert.Equal( 0, client.GetServersOfType( EServerType.CM ).Count );
        }
Exemplo n.º 3
0
        public void ServerLookupIsClearedWhenDisconnecting()
        {
            var msg = new ClientMsgProtobuf <CMsgClientServerList>(EMsg.ClientServerList);

            msg.Body.servers.Add(new CMsgClientServerList.Server
            {
                server_type = ( int )EServerType.CM,
                server_ip   = 0x7F000001, // 127.0.0.1
                server_port = 1234
            });

            var client = new DummyCMClient();

            client.HandleClientMsg(msg);

            Assert.Equal(1, client.GetServersOfType(EServerType.CM).Count);

            client.DummyDisconnect();
            Assert.Equal(0, client.GetServersOfType(EServerType.CM).Count);
        }
Exemplo n.º 4
0
        public void ServerLookupDoesNotAccumulateDuplicates()
        {
            var msg = new ClientMsgProtobuf<CMsgClientServerList>( EMsg.ClientServerList );
            msg.Body.servers.Add( new CMsgClientServerList.Server
            {
                server_type = ( int )EServerType.CM,
                server_ip = 0x7F000001, // 127.0.0.1
                server_port = 1234
            });

            var client = new DummyCMClient();
            client.HandleClientMsg( msg );
            Assert.Equal( 1, client.GetServersOfType( EServerType.CM ).Count );

            client.HandleClientMsg( msg );
            Assert.Equal( 1, client.GetServersOfType( EServerType.CM ).Count );
        }