public IEnumerator TestMessagingGetData()
        {
            MessageDistributor distributor = new MessageDistributor();

            MessageHub.StartListening("TestDesync", TestDesync);
            yield return(null);

            MessageHub.Enqueue(new Message("TestDesync", "test"));
            yield return(null);

            Assert.IsTrue(distributor.DequeueMessage());
        }
        public IEnumerator TestMessagingDirectUnsubscribe()
        {
            MessageDistributor distributor = new MessageDistributor();

            MessageHub.StartListening("TestDesync", TestDesyncUnsub);
            yield return(null);

            MessageHub.Enqueue(new Message("TestDesync", "test", distributor));
            yield return(null);

            Assert.IsTrue(distributor.DequeueMessage());
        }
        public void TestMessage()
        {
            MessageDistributor messageDistributor = new MessageDistributor();

            try
            {
                MessageHub.StartListening("TestMessage", TestAction);
            }
            catch (System.Exception e)
            {
                Assert.Fail("Fail in message listen \n" + e.Message);
            }

            try
            {
                MessageHub.Enqueue(new Message("TestMessage", "Test", 42));
            }
            catch (System.Exception e)
            {
                Assert.Fail("Fail in message push \n" + e.Message);
            }

            try
            {
                Assert.True(messageDistributor.DequeueMessage());
            }
            catch (System.Exception e)
            {
                Assert.Fail("Fail in message dequeue with message in queue \n" + e.Message);
            }

            try
            {
                Assert.False(messageDistributor.DequeueMessage());
            }
            catch (System.Exception e)
            {
                Assert.Fail("Fail in message dequeue without message in queue \n" + e.Message);
            }
        }