コード例 #1
0
        public void CreateAndDisposeClient()
        {
            CustomClient newClient = _factory.CreateClient(_clientSocket, _serverMock.Object);

            Assert.NotNull(newClient);
            Assert.NotNull(newClient.Socket);
            newClient.Dispose();
            Assert.Null(newClient.Socket);
        }
コード例 #2
0
        public void CreateClientTest()
        {
            CustomClient newClient = _factory.CreateClient(_clientSocket, _serverMock.Object);

            Assert.NotNull(newClient);
            Assert.NotNull(newClient.Server);
            Assert.NotNull(newClient.Socket);
            Assert.IsType <CustomClient>(newClient);
            Assert.NotEqual(Guid.Empty, newClient.Id);
            Assert.Equal(_clientSocket, newClient.Socket.GetSocket());
            Assert.Equal(_serverMock.Object, newClient.Server);
        }
コード例 #3
0
 public NetServerClientTests()
 {
     _randomizer          = new Randomizer((int)DateTime.UtcNow.Ticks);
     _serverConfiguration = new NetServerConfiguration("127.0.0.1", 4444);
     _serverMock          = new NetServerMock <CustomClient>(_serverConfiguration);
     _customClient        = new CustomClient(null)
     {
         Server = _serverMock.Object
     };
     _otherClient       = new CustomClient(null);
     _customClientsList = Enumerable.Repeat(new CustomClient(null), _randomizer.Byte());
     _packet            = new NetPacket();
     _packet.Write(_randomizer.String(_randomizer.Byte()));
 }