Exemplo n.º 1
0
        public void ArePropertiesEqual_All_Propertes_Is_Equal_InnerObjects_Are_Equal_If_Requested_Consideration()
        {
            var expected = new MyTestObject
            {
                Id          = 1,
                Description = "Description Equal",
                InnerObject = new MyTestInnerObject
                {
                    InnerId = 1
                }
            };

            var actual = new MyTestObject
            {
                Id          = 1,
                Description = "Description Equal",
                InnerObject = new MyTestInnerObject
                {
                    InnerId = 1
                }
            };

            var compareOption = new ObjectComparer.ComparisonOptions {
                ShouldRecursivelyCompareSubProperties = true
            };
            var result = ObjectComparer.ArePropertiesEqual(expected, actual, compareOption);

            Assert.True(result);
        }
        public virtual void CanConvertObjectToSameObject()
        {
            var obj = new MyTestObject();
            Attempt <object> result = obj.TryConvertTo <object>();

            Assert.AreEqual(obj, result.Result);
        }
        public void ClientToServer()
        {
            EasyNetwork.Server server = new EasyNetwork.Server("tcp://*:1982");
            EasyNetwork.Client clientOne = new EasyNetwork.Client("tcp://localhost:1982");
            EasyNetwork.Client clientTwo = new EasyNetwork.Client("tcp://localhost:1982");
            MyTestObject obj = new MyTestObject();
            obj.Value = 3.14159f;
            obj.Text = "Hello World!";

            OtherTestObject obj2 = new OtherTestObject();
            obj2.Value = 1234;
            obj2.Text = "Hello World Again!";

            server.Start();
            clientOne.Start();
            clientTwo.Start();

            clientOne.Send<MyTestObject>(obj);
            clientTwo.Send<OtherTestObject>(obj2);

            // Generically receive object at server from first client
            Object receivedObject = null;
            while (receivedObject == null)
            {
                Guid firstId;
                receivedObject = server.Receive(out firstId);

                if (receivedObject is MyTestObject)
                {
                    MyTestObject actualObjectOne = receivedObject as MyTestObject;
                    Assert.AreEqual(clientOne.Id, firstId);
                    Assert.AreEqual(obj.Value, actualObjectOne.Value);
                    Assert.AreEqual(obj.Text, actualObjectOne.Text);
                }

                Thread.Sleep(100);
            }

            // Generically receive object at server from second client
            receivedObject = null;
            while (receivedObject == null)
            {
                Guid secondId;
                receivedObject = server.Receive(out secondId);

                if (receivedObject is OtherTestObject)
                {
                    OtherTestObject actualObjectTwo = receivedObject as OtherTestObject;
                    Assert.AreEqual(clientTwo.Id, secondId);
                    Assert.AreEqual(obj2.Value, actualObjectTwo.Value);
                    Assert.AreEqual(obj2.Text, actualObjectTwo.Text);
                }

                Thread.Sleep(100);
            }

            server.Stop();
            clientOne.Stop();
            clientTwo.Stop();
        }
Exemplo n.º 4
0
        public void ArePropertiesEqual_All_Propertes_Is_Equal_InnerObjects_Not_Considerred_Equal_By_Default()
        {
            var expected = new MyTestObject
            {
                Id          = 1,
                Description = "Description Equal",
                InnerObject = new MyTestInnerObject
                {
                    InnerId = 1
                }
            };

            var actual = new MyTestObject
            {
                Id          = 1,
                Description = "Description Equal",
                InnerObject = new MyTestInnerObject
                {
                    InnerId = 1
                }
            };

            var result = ObjectComparer.ArePropertiesEqual(expected, actual);

            Assert.False(result);
        }
        public virtual void CanConvertObjectToString_Using_ToString_Overload()
        {
            Attempt <string> result = new MyTestObject().TryConvertTo <string>();

            Assert.IsTrue(result.Success);
            Assert.AreEqual("Hello world", result.Result);
        }
Exemplo n.º 6
0
 /// <summary>
 /// Event handler for receiving data for each client
 /// </summary>
 /// <param name="receivedObject">Received object from server</param>
 private void Clients_DataReceived(object receivedObject)
 {
     if (receivedObject is MyTestObject)
     {
         MyTestObject serverMsg = receivedObject as MyTestObject;
         dataReceivedPerClient.Add(new Guid(serverMsg.Text), serverMsg);
     }
 }
        protected override void Execute(NativeActivityContext context)
        {
            if (MyTestObject.Get(context) == null)
            {
                throw new Exception("MyTestObject is required");
            }

            context.CreateBookmark("waitingForNextStepBookmark", OnReadComplete);
        }
        public void Setup()
        {
            // Arrange
            _factory = new TestObjectFactory();

            _authenticatedRequestFactory = new AuthenticatedRequestFactory("test_app_key", "test_app_id", "test_app_secret");
            _requestParameters           = _factory.Create("Test Property 1", 2, true);
            _requestBody = _factory.Create("Test Property 4", 5, false);
        }
        public void ServerResponses()
        {
            EasyNetwork.Server server    = new EasyNetwork.Server("tcp://*:1982");
            EasyNetwork.Client clientOne = new EasyNetwork.Client("tcp://localhost:1982");
            EasyNetwork.Client clientTwo = new EasyNetwork.Client("tcp://localhost:1982");

            server.Start();
            clientOne.Start();
            clientTwo.Start();

            // Build and send a message to the server
            MyTestObject clientOneMessage = new MyTestObject();

            clientOneMessage.Value = 3.14159f;
            clientOneMessage.Text  = "Hello Server!";
            clientOne.Send <MyTestObject>(clientOneMessage);

            // Server receives, handles, and responds to message
            Object receivedObj = null;

            while (receivedObj == null)
            {
                Guid receivedId;
                receivedObj = server.Receive(out receivedId);

                if (receivedObj is MyTestObject)
                {
                    MyTestObject receivedMessage = receivedObj as MyTestObject;
                    MyTestObject responseMessage = new MyTestObject();
                    responseMessage.Value = receivedMessage.Value * 2;
                    responseMessage.Text  = "Howdy client!";

                    server.Send <MyTestObject>(receivedMessage, receivedId);
                }

                Thread.Sleep(100);
            }

            Thread.Sleep(1000);

            // Make sure the second client didn't receive anything
            Object clientTwoReceived = clientTwo.Receive();

            Assert.IsNull(clientTwoReceived);

            // The clientOne should have received the message destined for it
            Object clientReceived = clientOne.Receive();

            Assert.IsNotNull(clientReceived);
            Assert.IsTrue(clientReceived is MyTestObject);

            server.Stop();
            clientOne.Stop();
            clientTwo.Stop();
        }
    static void Main(string[] args)
    {
        var test     = new MyTestObject();
        var settings = new JsonSerializerSettings();

        settings.ContractResolver = new CustomResolver();
        settings.Formatting       = Formatting.Indented;
        var json = JsonConvert.SerializeObject(test, settings);

        Console.WriteLine(json);
    }
Exemplo n.º 11
0
        public void ClientToServer()
        {
            EasyNetwork.Server server    = new EasyNetwork.Server("tcp://*:1982");
            EasyNetwork.Client clientOne = new EasyNetwork.Client("tcp://localhost:1982");
            EasyNetwork.Client clientTwo = new EasyNetwork.Client("tcp://localhost:1982");

            // Set up event handler on server
            serverObjectsReceived.Clear();
            server.DataReceived += Server_DataReceived;

            // Build up some objects to send
            MyTestObject obj = new MyTestObject();

            obj.Value = 3.14159f;
            obj.Text  = "Hello World!";

            OtherTestObject obj2 = new OtherTestObject();

            obj2.Value = 1234;
            obj2.Text  = "Hello World Again!";

            server.Start();
            clientOne.Start();
            clientTwo.Start();

            clientOne.Send <MyTestObject>(obj);
            clientTwo.Send <OtherTestObject>(obj2);

            // Wait for both objects to arrive at server
            while (serverObjectsReceived.Count < 2)
            {
                Thread.Sleep(100);
            }

            Assert.AreEqual(2, serverObjectsReceived.Count);

            Assert.IsTrue(serverObjectsReceived[0].Item1 is MyTestObject);
            MyTestObject actualObjectOne = serverObjectsReceived[0].Item1 as MyTestObject;

            Assert.AreEqual(clientOne.Id, serverObjectsReceived[0].Item2);
            Assert.AreEqual(obj.Value, actualObjectOne.Value);
            Assert.AreEqual(obj.Text, actualObjectOne.Text);

            Assert.IsTrue(serverObjectsReceived[1].Item1 is OtherTestObject);
            OtherTestObject actualObjectTwo = serverObjectsReceived[1].Item1 as OtherTestObject;

            Assert.AreEqual(clientTwo.Id, serverObjectsReceived[1].Item2);
            Assert.AreEqual(obj2.Value, actualObjectTwo.Value);
            Assert.AreEqual(obj2.Text, actualObjectTwo.Text);

            server.Stop();
            clientOne.Stop();
            clientTwo.Stop();
        }
Exemplo n.º 12
0
        public void ServerResponseEventHandlers()
        {
            EasyNetwork.Server server    = new EasyNetwork.Server("tcp://*:1982");
            EasyNetwork.Client clientOne = new EasyNetwork.Client("tcp://localhost:1982");
            EasyNetwork.Client clientTwo = new EasyNetwork.Client("tcp://localhost:1982");

            // Set up event handles
            serverObjectsReceived.Clear();
            server.DataReceived    += Server_DataReceived;
            clientOneDataReceived   = null;
            clientTwoDataReceived   = null;
            clientOne.DataReceived += ClientOne_DataReceived;
            clientTwo.DataReceived += ClientTwo_DataReceived;

            server.Start();
            clientOne.Start();
            clientTwo.Start();

            // Build and send a message to the server
            MyTestObject clientOneMessage = new MyTestObject();

            clientOneMessage.Value = 3.14159f;
            clientOneMessage.Text  = "Hello Server!";
            clientOne.Send <MyTestObject>(clientOneMessage);

            // Server receives, handles, and responds to message
            while (serverObjectsReceived.Count == 0)
            {
                Thread.Sleep(100);
            }

            Assert.IsTrue(serverObjectsReceived.Count > 0);
            Assert.IsTrue(serverObjectsReceived[0].Item1 is MyTestObject);
            MyTestObject receivedMessage = serverObjectsReceived[0].Item1 as MyTestObject;
            MyTestObject responseMessage = new MyTestObject();

            responseMessage.Value = receivedMessage.Value * 2;
            responseMessage.Text  = "Howdy client!";
            server.Send <MyTestObject>(receivedMessage, serverObjectsReceived[0].Item2);

            Thread.Sleep(1000);

            // Make sure the second client didn't receive anything
            Assert.IsNull(clientTwoDataReceived);

            // The clientOne should have received the message destined for it
            Assert.IsNotNull(clientOneDataReceived);
            Assert.IsTrue(clientOneDataReceived is MyTestObject);

            server.Stop();
            clientOne.Stop();
            clientTwo.Stop();
        }
        List <MyTestObject> lst()
        {
            var rt = new List <MyTestObject>(5);

            for (int i = 0; i < rt.Capacity; i++)
            {
                var tmp = new MyTestObject {
                    age = i, name = "MyTestObject->" + i
                };
                rt.Add(tmp);
            }
            return(rt);
        }
Exemplo n.º 14
0
        public void ClientToServer()
        {
            EasyNetwork.Server server = new EasyNetwork.Server("tcp://*:1982");
            EasyNetwork.Client clientOne = new EasyNetwork.Client("tcp://localhost:1982");
            EasyNetwork.Client clientTwo = new EasyNetwork.Client("tcp://localhost:1982");

            // Set up event handler on server
            serverObjectsReceived.Clear();
            server.DataReceived += Server_DataReceived;

            // Build up some objects to send
            MyTestObject obj = new MyTestObject();
            obj.Value = 3.14159f;
            obj.Text = "Hello World!";

            OtherTestObject obj2 = new OtherTestObject();
            obj2.Value = 1234;
            obj2.Text = "Hello World Again!";

            server.Start();
            clientOne.Start();
            clientTwo.Start();

            clientOne.Send<MyTestObject>(obj);
            clientTwo.Send<OtherTestObject>(obj2);

            // Wait for both objects to arrive at server
            while (serverObjectsReceived.Count < 2)
            {
                Thread.Sleep(100);
            }

            Assert.AreEqual(2, serverObjectsReceived.Count);

            Assert.IsTrue(serverObjectsReceived[0].Item1 is MyTestObject);
            MyTestObject actualObjectOne = serverObjectsReceived[0].Item1 as MyTestObject;
            Assert.AreEqual(clientOne.Id, serverObjectsReceived[0].Item2);
            Assert.AreEqual(obj.Value, actualObjectOne.Value);
            Assert.AreEqual(obj.Text, actualObjectOne.Text);

            Assert.IsTrue(serverObjectsReceived[1].Item1 is OtherTestObject);
            OtherTestObject actualObjectTwo = serverObjectsReceived[1].Item1 as OtherTestObject;
            Assert.AreEqual(clientTwo.Id, serverObjectsReceived[1].Item2);
            Assert.AreEqual(obj2.Value, actualObjectTwo.Value);
            Assert.AreEqual(obj2.Text, actualObjectTwo.Text);

            server.Stop();
            clientOne.Stop();
            clientTwo.Stop();
        }
Exemplo n.º 15
0
        public void ArePropertiesEqual_All_Propertes_Is_Equal()
        {
            var expected = new MyTestObject
            {
                Id          = 1,
                Description = "Description Equal"
            };

            var actual = new MyTestObject
            {
                Id          = 1,
                Description = "Description Equal"
            };

            var result = ObjectComparer.ArePropertiesEqual(expected, actual);

            Assert.True(result);
        }
Exemplo n.º 16
0
        public void ArePropertiesEqual_One_Property_Is_Not_Equal()
        {
            var expected = new MyTestObject
            {
                Id          = 1,
                Description = "Description"
            };

            var actual = new MyTestObject
            {
                Id          = 1,
                Description = "Description Not Equal"
            };

            var result = ObjectComparer.ArePropertiesEqual(expected, actual);

            Assert.False(result);
        }
Exemplo n.º 17
0
        public void TestPolymorphicSimple()
        {
            var serializers = new Serializers();

            serializers.Register(MyTestObject.Read, MyTestObject.Write);
            var serializationCtx = new SerializationCtx(serializers);
            var testObject       = new MyTestObject("Monomorphic");

            byte[] data;
            using (var cookie = UnsafeWriter.NewThreadLocalWriter())
            {
                serializers.Write(serializationCtx, cookie.Writer, testObject);
                data = cookie.CloneData();
            }

            MyTestObject newTestObject = null;

            UnsafeReader.With(data, reader => newTestObject = serializers.Read <MyTestObject>(serializationCtx, reader, null));
            Assert.AreEqual(testObject.Data, newTestObject.Data);
        }
Exemplo n.º 18
0
    public static void Test()
    {
        MyTestObject myObject = new MyTestObject();

        myObject.name      = "雨松MOMO";
        myObject.TT        = "test";
        myObject.newOjbect = new MyTestNewObject()
        {
            level = 100
        };

        string json = JsonUtility.ToJson(myObject);

        Debug.Log(json);

        myObject = JsonUtility.FromJson <MyTestObject>(json);
        Debug.Log(myObject.name + " " + myObject.newOjbect.level);

        JsonUtility.FromJsonOverwrite(json, myObject);
    }
Exemplo n.º 19
0
        public void DoesntCallContextRegistryForLocalObjectFactoryReferences()
        {
            string xml = string.Format(
                @"<?xml version='1.0' encoding='UTF-8' ?>
<objects xmlns='http://www.springframework.net'>
	<object id='foo' type='{0}'>
        <property name='MyField' expression='@(theObject)' />
    </object>
</objects>"
                , typeof(MyTestObject).AssemblyQualifiedName
                );

            XmlObjectFactory of        = new XmlObjectFactory(new StringResource(xml, Encoding.UTF8));
            object           theObject = new object();

            of.RegisterSingleton("theObject", theObject);

            MyTestObject to = (MyTestObject)of.GetObject("foo");

            Assert.AreSame(theObject, to.MyField);
        }
Exemplo n.º 20
0
        public void PushToAllClients()
        {
            EasyNetwork.Server server = new EasyNetwork.Server("tcp://*:1982");
            server.DataReceived += Server_DataReceived;

            List<EasyNetwork.Client> clients = new List<EasyNetwork.Client>();
            const int NumClients = 10;

            for (int i = 0; i < NumClients; i++)
            {
                clients.Add(new EasyNetwork.Client("tcp://localhost:1982"));
                clients[clients.Count - 1].DataReceived += Clients_DataReceived;
            }

            server.Start();

            foreach (EasyNetwork.Client client in clients)
            {
                client.Start();
            }

            // Clients are registered with server after any messaging, so send something from each
            MyTestObject helloFromClient = new MyTestObject();
            helloFromClient.Value = 42.42f;
            helloFromClient.Text = "Hello Server!";

            foreach (EasyNetwork.Client client in clients)
            {
                client.Send<MyTestObject>(helloFromClient);
            }

            // Server should keep track of each client after hearing from them
            while (server.ClientList.Count < NumClients)
            {
                Thread.Sleep(100);
            }

            Assert.AreEqual(NumClients, server.ClientList.Count);

            // Send something to each client
            foreach (Guid clientId in server.ClientList)
            {
                MyTestObject helloFromServer = new MyTestObject();
                helloFromServer.Value = 4.2f;
                helloFromServer.Text = clientId.ToString();
                server.Send<MyTestObject>(helloFromServer, clientId);
            }

            // Wait until the appropriate number of responses are received by clients
            while (dataReceivedPerClient.Count < NumClients)
            {
                Thread.Sleep(100);
            }

            // Make sure each client has received their personalized messages from the server
            foreach (EasyNetwork.Client client in clients)
            {
                Object genericObject = dataReceivedPerClient[client.Id];
                Assert.IsNotNull(genericObject);

                if (genericObject is MyTestObject)
                {
                    MyTestObject receivedObject = genericObject as MyTestObject;
                    Assert.AreEqual(client.Id.ToString(), receivedObject.Text);
                }
            }

            server.Stop();

            foreach (EasyNetwork.Client client in clients)
            {
                client.Stop();
            }
        }
		public virtual void CanConvertObjectToString_Using_ToString_Overload()
		{
			var result = new MyTestObject().TryConvertTo<string>();

			Assert.IsTrue(result.Success);
			Assert.AreEqual("Hello world", result.Result);
		}
        public virtual void CanConvertObjectToSameObject()
        {
            var obj = new MyTestObject();
            var result = obj.TryConvertTo<object>();

            Assert.AreEqual(obj, result.Result);            
        }
Exemplo n.º 23
0
        public void ServerResponses()
        {
            EasyNetwork.Server server = new EasyNetwork.Server("tcp://*:1982");
            EasyNetwork.Client clientOne = new EasyNetwork.Client("tcp://localhost:1982");
            EasyNetwork.Client clientTwo = new EasyNetwork.Client("tcp://localhost:1982");

            server.Start();
            clientOne.Start();
            clientTwo.Start();

            // Build and send a message to the server
            MyTestObject clientOneMessage = new MyTestObject();
            clientOneMessage.Value = 3.14159f;
            clientOneMessage.Text = "Hello Server!";
            clientOne.Send<MyTestObject>(clientOneMessage);

            // Server receives, handles, and responds to message
            Object receivedObj = null;
            while (receivedObj == null)
            {
                Guid receivedId;
                receivedObj = server.Receive(out receivedId);

                if (receivedObj is MyTestObject)
                {
                    MyTestObject receivedMessage = receivedObj as MyTestObject;
                    MyTestObject responseMessage = new MyTestObject();
                    responseMessage.Value = receivedMessage.Value * 2;
                    responseMessage.Text = "Howdy client!";

                    server.Send<MyTestObject>(receivedMessage, receivedId);
                }

                Thread.Sleep(100);
            }

            Thread.Sleep(1000);

            // Make sure the second client didn't receive anything
            Object clientTwoReceived = clientTwo.Receive();
            Assert.IsNull(clientTwoReceived);

            // The clientOne should have received the message destined for it
            Object clientReceived = clientOne.Receive();
            Assert.IsNotNull(clientReceived);
            Assert.IsTrue(clientReceived is MyTestObject);

            server.Stop();
            clientOne.Stop();
            clientTwo.Stop();
        }
Exemplo n.º 24
0
        public void PushToAllClients()
        {
            EasyNetwork.Server server = new EasyNetwork.Server("tcp://*:1982");
            server.DataReceived += Server_DataReceived;

            List <EasyNetwork.Client> clients = new List <EasyNetwork.Client>();
            const int NumClients = 10;

            for (int i = 0; i < NumClients; i++)
            {
                clients.Add(new EasyNetwork.Client("tcp://localhost:1982"));
                clients[clients.Count - 1].DataReceived += Clients_DataReceived;
            }

            server.Start();

            foreach (EasyNetwork.Client client in clients)
            {
                client.Start();
            }

            // Clients are registered with server after any messaging, so send something from each
            MyTestObject helloFromClient = new MyTestObject();

            helloFromClient.Value = 42.42f;
            helloFromClient.Text  = "Hello Server!";

            foreach (EasyNetwork.Client client in clients)
            {
                client.Send <MyTestObject>(helloFromClient);
            }

            // Server should keep track of each client after hearing from them
            while (server.ClientList.Count < NumClients)
            {
                Thread.Sleep(100);
            }

            Assert.AreEqual(NumClients, server.ClientList.Count);

            // Send something to each client
            foreach (Guid clientId in server.ClientList)
            {
                MyTestObject helloFromServer = new MyTestObject();
                helloFromServer.Value = 4.2f;
                helloFromServer.Text  = clientId.ToString();
                server.Send <MyTestObject>(helloFromServer, clientId);
            }

            // Wait until the appropriate number of responses are received by clients
            while (dataReceivedPerClient.Count < NumClients)
            {
                Thread.Sleep(100);
            }

            // Make sure each client has received their personalized messages from the server
            foreach (EasyNetwork.Client client in clients)
            {
                Object genericObject = dataReceivedPerClient[client.Id];
                Assert.IsNotNull(genericObject);

                if (genericObject is MyTestObject)
                {
                    MyTestObject receivedObject = genericObject as MyTestObject;
                    Assert.AreEqual(client.Id.ToString(), receivedObject.Text);
                }
            }

            server.Stop();

            foreach (EasyNetwork.Client client in clients)
            {
                client.Stop();
            }
        }
Exemplo n.º 25
0
        public void ClientToServer()
        {
            EasyNetwork.Server server    = new EasyNetwork.Server("tcp://*:1982");
            EasyNetwork.Client clientOne = new EasyNetwork.Client("tcp://localhost:1982");
            EasyNetwork.Client clientTwo = new EasyNetwork.Client("tcp://localhost:1982");
            MyTestObject       obj       = new MyTestObject();

            obj.Value = 3.14159f;
            obj.Text  = "Hello World!";

            OtherTestObject obj2 = new OtherTestObject();

            obj2.Value = 1234;
            obj2.Text  = "Hello World Again!";

            server.Start();
            clientOne.Start();
            clientTwo.Start();

            clientOne.Send <MyTestObject>(obj);
            clientTwo.Send <OtherTestObject>(obj2);

            // Generically receive object at server from first client
            Object receivedObject = null;

            while (receivedObject == null)
            {
                Guid firstId;
                receivedObject = server.Receive(out firstId);

                if (receivedObject is MyTestObject)
                {
                    MyTestObject actualObjectOne = receivedObject as MyTestObject;
                    Assert.AreEqual(clientOne.Id, firstId);
                    Assert.AreEqual(obj.Value, actualObjectOne.Value);
                    Assert.AreEqual(obj.Text, actualObjectOne.Text);
                }

                Thread.Sleep(100);
            }

            // Generically receive object at server from second client
            receivedObject = null;
            while (receivedObject == null)
            {
                Guid secondId;
                receivedObject = server.Receive(out secondId);

                if (receivedObject is OtherTestObject)
                {
                    OtherTestObject actualObjectTwo = receivedObject as OtherTestObject;
                    Assert.AreEqual(clientTwo.Id, secondId);
                    Assert.AreEqual(obj2.Value, actualObjectTwo.Value);
                    Assert.AreEqual(obj2.Text, actualObjectTwo.Text);
                }

                Thread.Sleep(100);
            }

            server.Stop();
            clientOne.Stop();
            clientTwo.Stop();
        }
 public MainWindow()
 {
     myTestObject     = new MyTestObject();
     this.DataContext = this;
     InitializeComponent();
 }
Exemplo n.º 27
0
        public void ServerResponseEventHandlers()
        {
            EasyNetwork.Server server = new EasyNetwork.Server("tcp://*:1982");
            EasyNetwork.Client clientOne = new EasyNetwork.Client("tcp://localhost:1982");
            EasyNetwork.Client clientTwo = new EasyNetwork.Client("tcp://localhost:1982");

            // Set up event handles
            serverObjectsReceived.Clear();
            server.DataReceived += Server_DataReceived;
            clientOneDataReceived = null;
            clientTwoDataReceived = null;
            clientOne.DataReceived += ClientOne_DataReceived;
            clientTwo.DataReceived += ClientTwo_DataReceived;

            server.Start();
            clientOne.Start();
            clientTwo.Start();

            // Build and send a message to the server
            MyTestObject clientOneMessage = new MyTestObject();
            clientOneMessage.Value = 3.14159f;
            clientOneMessage.Text = "Hello Server!";
            clientOne.Send<MyTestObject>(clientOneMessage);

            // Server receives, handles, and responds to message
            while (serverObjectsReceived.Count == 0)
            {
                Thread.Sleep(100);
            }

            Assert.IsTrue(serverObjectsReceived.Count > 0);
            Assert.IsTrue(serverObjectsReceived[0].Item1 is MyTestObject);
            MyTestObject receivedMessage = serverObjectsReceived[0].Item1 as MyTestObject;
            MyTestObject responseMessage = new MyTestObject();
            responseMessage.Value = receivedMessage.Value * 2;
            responseMessage.Text = "Howdy client!";
            server.Send<MyTestObject>(receivedMessage, serverObjectsReceived[0].Item2);

            Thread.Sleep(1000);

            // Make sure the second client didn't receive anything
            Assert.IsNull(clientTwoDataReceived);

            // The clientOne should have received the message destined for it
            Assert.IsNotNull(clientOneDataReceived);
            Assert.IsTrue(clientOneDataReceived is MyTestObject);

            server.Stop();
            clientOne.Stop();
            clientTwo.Stop();
        }