ConnectToOnlineServerTests ClassDelta Engine Documentation
Inheritance Hierarchy

System Object
  DeltaEngine.Networking.Tests.Tcp ConnectToOnlineServerTests

Namespace: DeltaEngine.Networking.Tests.Tcp
Assembly: DeltaEngine.Networking.Tests (in DeltaEngine.Networking.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public class ConnectToOnlineServerTests

The ConnectToOnlineServerTests type exposes the following members.

Constructors

  NameDescription
Public methodConnectToOnlineServerTests
Initializes a new instance of the ConnectToOnlineServerTests class
Top
Methods

  NameDescription
Public methodCreateConnectionAndWaitUntilConnected
Public methodDisposeConnection
Public methodLoginWithoutApiKeyShouldFail
Public methodSendingNullMessagesIsNotAllowed
Public methodSendInvalidMessageShouldBeRejectedByServer
Public methodSendLogMessageAfterLoginDoesNotCauseServerError
Public methodSendMessageWithoutLoginCausesServerError
Public methodShouldBeConnected
Top
Examples

[Test]
public void ShouldBeConnected()
{
    Assert.IsTrue(connection.IsConnected);
}
[Test]
public void SendingNullMessagesIsNotAllowed()
{
    Assert.Throws<ArgumentNullException>(() => SendMessageAndWaitForServerResponse(null));
}
[Test]
public void SendMessageWithoutLoginCausesServerError()
{
    SendMessageAndWaitForServerResponse(new LogInfoMessage("Hi"));
    Assert.IsInstanceOf<ServerError>(serverResponse);
}
[Test]
public void LoginWithoutApiKeyShouldFail()
{
    SendMessageAndWaitForServerResponse(new LoginRequest("", ""));
    Assert.IsInstanceOf<ServerError>(serverResponse);
}
[Test]
public void SendInvalidMessageShouldBeRejectedByServer()
{
    Login();
    SendMessageAndWaitForServerResponse(new Vector2D(0, 1));
    Thread.Sleep(50);
    Assert.IsInstanceOf<SetProject>(serverResponse);
}
[Test]
public void SendLogMessageAfterLoginDoesNotCauseServerError()
{
    Login();
    connection.Send(new LogInfoMessage("Hi Server"));
    Assert.IsNotInstanceOf<ServerError>(serverResponse);
}
See Also