public void ThenComplexMessageObjectShouldReturnSuccessCodeAndInfo()
        {
            isComplexObjectPublished = false;
            Pubnub pubnub = new Pubnub("demo", "demo", "", "", false);

            PubnubUnitTest unitTest = new PubnubUnitTest();

            unitTest.TestClassName = "WhenAMessageIsPublished";
            unitTest.TestCaseName  = "ThenComplexMessageObjectShouldReturnSuccessCodeAndInfo";
            pubnub.PubnubUnitTest  = unitTest;

            string channel = "hello_my_channel";
            object message = new PubnubDemoObject();

            messageComplexObjectForPublish = JsonConvert.SerializeObject(message);

            EnqueueCallback(() => pubnub.Publish <string>(channel, message, ReturnSuccessComplexObjectPublishCodeCallback, DummyErrorCallback));
            EnqueueConditional(() => isComplexObjectPublishCheck);

            EnqueueCallback(() =>
            {
                if (!isComplexObjectPublished)
                {
                    Assert.IsTrue(isComplexObjectPublished, "Complex Object Publish Failed");
                }
                else
                {
                    EnqueueCallback(() => pubnub.DetailedHistory <string>(channel, -1, complexObjectPublishTimetoken, -1, false, CaptureComplexObjectDetailedHistoryCallback, DummyErrorCallback));
                    EnqueueConditional(() => isComplexObjectDetailedHistoryCheck);
                    EnqueueCallback(() => Assert.IsTrue(isComplexObjectDetailedHistory, "Unable to match the successful unencrypt object Publish"));
                }
            });

            EnqueueTestComplete();
        }
        public void ThenComplexMessageObjectShouldReturnSuccessCodeAndInfo()
        {
            isComplexObjectPublished = false;
            mrePublish         = new ManualResetEvent(false);
            mreDetailedHistory = new ManualResetEvent(false);

            ThreadPool.QueueUserWorkItem((s) =>
            {
                Pubnub pubnub = new Pubnub(PubnubCommon.PublishKey, PubnubCommon.SubscribeKey, "", "", false);

                PubnubUnitTest unitTest = new PubnubUnitTest();
                unitTest.TestClassName  = "WhenAMessageIsPublished";
                unitTest.TestCaseName   = "ThenComplexMessageObjectShouldReturnSuccessCodeAndInfo";
                pubnub.PubnubUnitTest   = unitTest;

                string channel = "hello_my_channel";
                object message = new PubnubDemoObject();
                messageComplexObjectForPublish = JsonConvert.SerializeObject(message);

                EnqueueCallback(() => pubnub.Publish <string>(channel, message, ReturnSuccessComplexObjectPublishCodeCallback, DummyErrorCallback));
                mrePublish.WaitOne(310 * 1000);

                EnqueueCallback(() =>
                {
                    if (!isComplexObjectPublished)
                    {
                        Assert.IsTrue(isComplexObjectPublished, "Complex Object Publish Failed");
                    }
                    else
                    {
                        pubnub.DetailedHistory <string>(channel, -1, complexObjectPublishTimetoken, -1, false, CaptureComplexObjectDetailedHistoryCallback, DummyErrorCallback);
                        mreDetailedHistory.WaitOne(310 * 1000);
                        Assert.IsTrue(isComplexObjectDetailedHistory, "Unable to match the successful unencrypt object Publish");
                    }
                });

                EnqueueTestComplete();
            });
        }
        public void ThenComplexMessageObjectShouldReturnSuccessCodeAndInfo()
        {
            isComplexObjectPublished = false;
            mrePublish = new ManualResetEvent(false);
            mreDetailedHistory = new ManualResetEvent(false);

            ThreadPool.QueueUserWorkItem((s) =>
                {
                    Pubnub pubnub = new Pubnub(PubnubCommon.PublishKey, PubnubCommon.SubscribeKey, "", "", false);

                    PubnubUnitTest unitTest = new PubnubUnitTest();
                    unitTest.TestClassName = "WhenAMessageIsPublished";
                    unitTest.TestCaseName = "ThenComplexMessageObjectShouldReturnSuccessCodeAndInfo";
                    pubnub.PubnubUnitTest = unitTest;

                    string channel = "hello_my_channel";
                    object message = new PubnubDemoObject();
                    messageComplexObjectForPublish = JsonConvert.SerializeObject(message);

                    EnqueueCallback(() => pubnub.Publish<string>(channel, message, ReturnSuccessComplexObjectPublishCodeCallback, ComplexObjectMessagePublishErrorCallback));
                    mrePublish.WaitOne(310 * 1000);

                    EnqueueCallback(() =>
                        {
                            if (!isComplexObjectPublished)
                            {
                                Assert.IsTrue(isComplexObjectPublished, "Complex Object Publish Failed");
                            }
                            else
                            {
                                pubnub.DetailedHistory<string>(channel, -1, complexObjectPublishTimetoken, -1, false, CaptureComplexObjectDetailedHistoryCallback, DummyDetailedHistoryErrorCallback);
                                mreDetailedHistory.WaitOne(310 * 1000);
                                Assert.IsTrue(isComplexObjectDetailedHistory, "Unable to match the successful unencrypt object Publish");
                            }
                        });

                    EnqueueCallback(() =>
                            {
                                pubnub.PubnubUnitTest = null;
                                pubnub = null;
                            }
                        );
                    EnqueueTestComplete();
                });
        }
        public void ThenComplexMessageObjectShouldReturnSuccessCodeAndInfo()
        {
            isComplexObjectPublished = false;
            Pubnub pubnub = new Pubnub(PubnubCommon.PublishKey, PubnubCommon.SubscribeKey, "", "", false);

            PubnubUnitTest unitTest = new PubnubUnitTest();
            unitTest.TestClassName = "WhenAMessageIsPublished";
            unitTest.TestCaseName = "ThenComplexMessageObjectShouldReturnSuccessCodeAndInfo";
            pubnub.PubnubUnitTest = unitTest;

            string channel = "hello_my_channel";
            object message = new PubnubDemoObject();
            messageComplexObjectForPublish = JsonConvert.SerializeObject(message);

            EnqueueCallback(() => pubnub.Publish<string>(channel, message, ReturnSuccessComplexObjectPublishCodeCallback, DummyErrorCallback));
            EnqueueConditional(() => isComplexObjectPublishCheck);

            EnqueueCallback(() =>
                {
                    if (!isComplexObjectPublished)
                    {
                        Assert.IsTrue(isComplexObjectPublished, "Complex Object Publish Failed");
                    }
                    else
                    {
                        EnqueueCallback(() => pubnub.DetailedHistory<string>(channel, -1, complexObjectPublishTimetoken, -1, false, CaptureComplexObjectDetailedHistoryCallback, DummyErrorCallback));
                        EnqueueConditional(() => isComplexObjectDetailedHistoryCheck);
                        EnqueueCallback(() => Assert.IsTrue(isComplexObjectDetailedHistory, "Unable to match the successful unencrypt object Publish"));
                    }
                });

            EnqueueTestComplete();
        }