public void UDPServer_ReceivesObjects_CorrectObjectReceived() { //Arrange MockObjectMessage receivedObject = null; var connectTransports = UDPObjectTransportChannel.GetConnectObjectTransports(); var server = connectTransports.Item1; var client = connectTransports.Item2; //Act server.Receive <MockObjectMessage>(o => { receivedObject = o; }).Execute(); client.Send(new MockObjectMessage() { Property1_string = "hello world!", Property2_int = 123, Property3_decimal = 12.3M }).Execute(); Utilities.WaitFor(ref receivedObject); //Assert Assert.AreEqual("hello world!", receivedObject.Property1_string); Assert.AreEqual(123, receivedObject.Property2_int); Assert.AreEqual(12.3M, receivedObject.Property3_decimal); }
public void CleanUpServer() { if (udpServer != null) { udpServer.Stop(); } if (udpClient != null) { udpClient.Stop(); } if (udpClient2 != null) { udpClient2.Stop(); } UDPObjectTransportChannel.TearDown(); }