Namespace: DeltaEngine.Networking.Tests.Tcp
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 CollectData() { var dataCollector = new DataCollector(); dataCollector.ObjectFinished += container => collectedDataObjects.Add(container); Assert.IsEmpty(collectedDataObjects); var bytePackages = SplitDataStream(CreateByteList(), 7, 7, 8, 3, 1); foreach (byte[] package in bytePackages) dataCollector.ReadBytes(package, 0, package.Length); Assert.AreEqual(3, collectedDataObjects.Count); }
[Test] public void CollectDataWithIncompleteMessage() { var dataCollector = new DataCollector(); dataCollector.ObjectFinished += container => collectedDataObjects.Add(container); var byteArray = GetTestBytesWithLengthHeader(1); dataCollector.ReadBytes(byteArray, 0, 0); dataCollector.ReadBytes(byteArray, 0, byteArray.Length - 1); dataCollector.ReadBytes(byteArray, byteArray.Length - 1, 1); Assert.AreEqual(1, collectedDataObjects.Count); Assert.AreEqual(1, collectedDataObjects[0].Data.Length); Assert.AreEqual(100, collectedDataObjects[0].Data[0]); }
See Also