Exemplo n.º 1
0
        public void ThenEncryptObjectPublishShouldReturnSuccessCodeAndInfo()
        {
            isEncryptObjectPublished = false;
            Pubnub pubnub  = new Pubnub("demo", "demo", "", "enigma", false);
            string channel = "hello_my_channel";
            object message = new SecretCustomClass();

            messageObjectForEncryptPublish = JsonConvert.SerializeObject(message);

            PubnubUnitTest unitTest = new PubnubUnitTest();

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

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

            EnqueueCallback(() =>
            {
                if (!isEncryptObjectPublished)
                {
                    Assert.IsTrue(isEncryptObjectPublished, "Encrypt Object Publish Failed");
                }
                else
                {
                    EnqueueCallback(() => pubnub.DetailedHistory <string>(channel, -1, encryptObjectPublishTimetoken, -1, false, CaptureEncryptObjectDetailedHistoryCallback, DummyErrorCallback));
                    EnqueueConditional(() => isEncryptObjectDHCheck);
                    EnqueueCallback(() => Assert.IsTrue(isEncryptObjectDH, "Unable to match the successful encrypt object Publish"));
                }
            });

            EnqueueTestComplete();
        }
Exemplo n.º 2
0
        public void ThenEncryptObjectPublishShouldReturnSuccessCodeAndInfo()
        {
            isEncryptObjectPublished = false;
            mrePublish         = new ManualResetEvent(false);
            mreDetailedHistory = new ManualResetEvent(false);

            ThreadPool.QueueUserWorkItem((s) =>
            {
                Pubnub pubnub  = new Pubnub(PubnubCommon.PublishKey, PubnubCommon.SubscribeKey, "", "enigma", false);
                string channel = "hello_my_channel";
                object message = new SecretCustomClass();
                messageObjectForEncryptPublish = JsonConvert.SerializeObject(message);

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

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

                EnqueueCallback(() =>
                {
                    if (!isEncryptObjectPublished)
                    {
                        Assert.IsTrue(isEncryptObjectPublished, "Encrypt Object Publish Failed");
                    }
                    else
                    {
                        pubnub.DetailedHistory <string>(channel, -1, encryptObjectPublishTimetoken, -1, false, CaptureEncryptObjectDetailedHistoryCallback, DummyErrorCallback);
                        mreDetailedHistory.WaitOne(310 * 1000);
                        Assert.IsTrue(isEncryptObjectDH, "Unable to match the successful encrypt object Publish");
                    }
                });

                EnqueueTestComplete();
            });
        }
        public void ThenEncryptObjectPublishShouldReturnSuccessCodeAndInfo()
        {
            isEncryptObjectPublished = false;
            mrePublish = new ManualResetEvent(false);
            mreDetailedHistory = new ManualResetEvent(false);

            ThreadPool.QueueUserWorkItem((s) =>
                {
                    Pubnub pubnub = new Pubnub(PubnubCommon.PublishKey, PubnubCommon.SubscribeKey, "", "enigma", false);
                    string channel = "hello_my_channel";
                    object message = new SecretCustomClass();
                    messageObjectForEncryptPublish = JsonConvert.SerializeObject(message);

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

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

                    EnqueueCallback(() =>
                    {
                        if (!isEncryptObjectPublished)
                        {
                            Assert.IsTrue(isEncryptObjectPublished, "Encrypt Object Publish Failed");
                        }
                        else
                        {
                            pubnub.DetailedHistory<string>(channel, -1, encryptObjectPublishTimetoken, -1, false, CaptureEncryptObjectDetailedHistoryCallback, DummyDetailedHistoryErrorCallback);
                            mreDetailedHistory.WaitOne(310 * 1000);
                            Assert.IsTrue(isEncryptObjectDH, "Unable to match the successful encrypt object Publish");
                        }
                    });

                    EnqueueCallback(() =>
                            {
                                pubnub.PubnubUnitTest = null;
                                pubnub = null;
                            }
                        );
                    EnqueueTestComplete();
                });
        }
Exemplo n.º 4
0
        public void ThenEncryptObjectPublishShouldReturnSuccessCodeAndInfo()
        {
            isEncryptObjectPublished = false;
            Pubnub pubnub = new Pubnub(PubnubCommon.PublishKey, PubnubCommon.SubscribeKey, "", "enigma", false);
            string channel = "hello_my_channel";
            object message = new SecretCustomClass();
            messageObjectForEncryptPublish = JsonConvert.SerializeObject(message);

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

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

            EnqueueCallback(() =>
            {
                if (!isEncryptObjectPublished)
                {
                    Assert.IsTrue(isEncryptObjectPublished, "Encrypt Object Publish Failed");
                }
                else
                {
                    EnqueueCallback(() => pubnub.DetailedHistory<string>(channel, -1, encryptObjectPublishTimetoken, -1, false, CaptureEncryptObjectDetailedHistoryCallback, DummyErrorCallback));
                   EnqueueConditional(() => isEncryptObjectDHCheck);
                   EnqueueCallback(() => Assert.IsTrue(isEncryptObjectDH, "Unable to match the successful encrypt object Publish"));
                }
            });

            EnqueueTestComplete();
        }