Namespace: DeltaEngine.Networking.Tests
Assembly: DeltaEngine.Networking.Tests (in DeltaEngine.Networking.Tests.dll) Version: 1.1.1.0 (1.1.1)
Assembly: DeltaEngine.Networking.Tests (in DeltaEngine.Networking.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax
Examples
[Test] public void ConvertBinaryDataToArray() { var server = new MockServer(); Assert.IsNull(server.LastMessage); var client = new MockClient(server); client.Connect("localhost", 1); client.Send(new TextMessage("Hi")); var serverMessage = server.LastMessage as TextMessage; byte[] byteArray = BinaryDataExtensions.ToByteArrayWithLengthHeader(serverMessage); int classNameLength = "TestMessage".Length + StringLengthByte; int textLength = "Hi".Length + StringLengthByte + StringIsNullBooleanByte; Assert.AreEqual(LengthOfNetworkMessage + LengthOfDataVersion + classNameLength + textLength, byteArray.Length); }
See Also