Inheritance Hierarchy
DeltaEngine.Networking.Tests ServerTests
Namespace: DeltaEngine.Networking.Tests
Assembly: DeltaEngine.Networking.Tests (in DeltaEngine.Networking.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax
The ServerTests type exposes the following members.
Constructors
Name | Description | |
---|---|---|
ServerTests | Initializes a new instance of the ServerTests class |
Methods
Name | Description | |
---|---|---|
ConnectClient | ||
DisconnectClient | ||
DisconnectServer | ||
InitiallyNoClients | ||
ListenForClients | ||
SetUp |
Examples
[Test] public void ListenForClients() { server.Start(800); Assert.IsTrue(server.IsRunning); }
[Test] public void InitiallyNoClients() { Assert.AreEqual(0, server.ListenPort); Assert.AreEqual(0, server.NumberOfConnectedClients); }
[Test] public void ConnectClient() { bool didClientConnect = false; server.ClientConnected += client => didClientConnect = true; CreateConnectedClient(); Assert.AreEqual(1, server.NumberOfConnectedClients); Assert.IsTrue(didClientConnect); }
[Test] public void DisconnectClient() { bool didClientDisconnect = false; server.ClientDisconnected += c => didClientDisconnect = true; var client = CreateConnectedClient(); client.Dispose(); Assert.IsTrue(didClientDisconnect); }
[Test] public void DisconnectServer() { var client = CreateConnectedClient(); server.Dispose(); Assert.IsFalse(client.IsConnected); }
See Also