當前位置: 首頁>>代碼示例>>C#>>正文


C# UnitTest.PubnubUnitTest類代碼示例

本文整理匯總了C#中PubnubSilverlight.UnitTest.PubnubUnitTest的典型用法代碼示例。如果您正苦於以下問題:C# PubnubUnitTest類的具體用法?C# PubnubUnitTest怎麽用?C# PubnubUnitTest使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


PubnubUnitTest類屬於PubnubSilverlight.UnitTest命名空間,在下文中一共展示了PubnubUnitTest類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ThenSubKeyLevelWithReadShouldReturnSuccess

        public void ThenSubKeyLevelWithReadShouldReturnSuccess()
        {
            currentUnitTestCase = "ThenSubKeyLevelWithReadShouldReturnSuccess";
            mreGrant = new ManualResetEvent(false);

            receivedGrantMessage = false;

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

                    PubnubUnitTest unitTest = new PubnubUnitTest();
                    unitTest.TestClassName = "WhenGrantIsRequested";
                    unitTest.TestCaseName = "ThenSubKeyLevelWithReadShouldReturnSuccess";
                    pubnub.PubnubUnitTest = unitTest;
                    if (PubnubCommon.PAMEnabled)
                    {
                        EnqueueCallback(() => pubnub.GrantAccess<string>("", true, false, 5, AccessToSubKeyLevelCallback, DummyErrorCallback));
                        mreGrant.WaitOne(310 * 1000);
                        EnqueueCallback(() => Assert.IsTrue(receivedGrantMessage, "WhenGrantIsRequested -> ThenSubKeyLevelWithReadShouldReturnSuccess failed."));
                    }
                    else
                    {
                        EnqueueCallback(() => Assert.Inconclusive("PAM Not Enabled for WhenGrantIsRequested -> ThenSubKeyLevelWithReadShouldReturnSuccess."));
                    }
                    EnqueueTestComplete();
                });
        }
開發者ID:jugalkishor-sujal,項目名稱:c-sharp,代碼行數:28,代碼來源:WhenGrantIsRequested.cs

示例2: ThenChannelLevelShouldReturnSuccess

        public void ThenChannelLevelShouldReturnSuccess()
        {
            auditAccessCallbackInvoked = false;

            currentUnitTestCase = "ThenChannelLevelShouldReturnSuccess";

            receivedAuditMessage = false;

            Pubnub pubnub = new Pubnub(PubnubCommon.PublishKey, PubnubCommon.SubscribeKey, PubnubCommon.SecretKey, "", false);

            PubnubUnitTest unitTest = new PubnubUnitTest();
            unitTest.TestClassName = "WhenAuditIsRequested";
            unitTest.TestCaseName = "ThenChannelLevelShouldReturnSuccess";
            pubnub.PubnubUnitTest = unitTest;

            string channel = "hello_my_channel";

            if (PubnubCommon.PAMEnabled)
            {
                EnqueueCallback(() => pubnub.AuditAccess<string>(channel, AccessToChannelLevelCallback, DummyErrorCallback));
                //Thread.Sleep(1000);
                EnqueueConditional(() => auditAccessCallbackInvoked);
                EnqueueCallback(() => Assert.IsTrue(receivedAuditMessage, "WhenAuditIsRequested -> ThenChannelLevelShouldReturnSuccess failed."));
            }
            else
            {
                EnqueueCallback(() => Assert.Inconclusive("PAM Not Enabled for WhenAuditIsRequested -> ThenChannelLevelShouldReturnSuccess"));
            }
            EnqueueTestComplete();
        }
開發者ID:Evgeniy20,項目名稱:c-sharp,代碼行數:30,代碼來源:WhenAuditIsRequested.cs

示例3: Init

        public void Init()
        {
            if (!PubnubCommon.PAMEnabled)
            {
                EnqueueTestComplete();
                return;
            }

            receivedGrantMessage = false;

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

                    PubnubUnitTest unitTest = new PubnubUnitTest();
                    unitTest.TestClassName = "GrantRequestUnitTest";
                    unitTest.TestCaseName = "Init2";
                    pubnub.PubnubUnitTest = unitTest;

                    string channel = "hello_my_channel,hello_my_channel-pnpres";
                    EnqueueCallback(() => pubnub.GrantAccess<string>(channel, true, true, 20, ThenPresenceInitializeShouldReturnGrantMessage, DummyErrorCallback));
                    mreGrant.WaitOne(310 * 1000);

                    EnqueueCallback(() => Assert.IsTrue(receivedGrantMessage, "WhenAClientIsPresent Grant access failed."));
                    EnqueueTestComplete();
                });
        }
開發者ID:jonasduerto,項目名稱:c-sharp,代碼行數:27,代碼來源:WhenAClientIsPresented.cs

示例4: ThenNoExistChannelShouldReturnNotSubscribed

        public void ThenNoExistChannelShouldReturnNotSubscribed()
        {
            receivedNotSubscribedMessage = false;
            mreUnsubscribe = new ManualResetEvent(false);

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

                    PubnubUnitTest unitTest = new PubnubUnitTest();
                    unitTest.TestClassName = "WhenUnsubscribedToAChannel";
                    unitTest.TestCaseName = "ThenNoExistChannelShouldReturnNotSubscribed";

                    pubnub.PubnubUnitTest = unitTest;

                    string channel = "hello_my_channel";

                    EnqueueCallback(() => pubnub.Unsubscribe<string>(channel, DummyMethodNoExistChannelUnsubscribeChannelUserCallback, DummyMethodNoExistChannelUnsubscribeChannelConnectCallback, DummyMethodNoExistChannelUnsubscribeChannelDisconnectCallback1, NoExistChannelErrorCallback));
                    mreUnsubscribe.WaitOne(310 * 1000);

                    EnqueueCallback(() => pubnub.EndPendingRequests());
                    EnqueueCallback(() => Assert.IsTrue(receivedNotSubscribedMessage, "WhenUnsubscribedToAChannel --> ThenNoExistChannelShouldReturnNotSubscribed Failed"));
                    EnqueueTestComplete();
                });
        }
開發者ID:jugalkishor-sujal,項目名稱:c-sharp,代碼行數:25,代碼來源:WhenUnsubscribedToAChannel.cs

示例5: Init

        public void Init()
        {
            if (!PubnubCommon.PAMEnabled)
            {
                EnqueueTestComplete();
                return;
            }

            receivedGrantMessage = false;

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

                    PubnubUnitTest unitTest = new PubnubUnitTest();
                    unitTest.TestClassName = "GrantRequestUnitTest";
                    unitTest.TestCaseName = "Init3";
                    pubnub.PubnubUnitTest = unitTest;

                    EnqueueCallback(() => pubnub.ChannelGroupGrantAccess<string>(channelGroupName, true, true, 20, ThenChannelGroupInitializeShouldReturnGrantMessage, DummySubscribeErrorCallback));
                    grantManualEvent.WaitOne(310 * 1000);

                    EnqueueCallback(() => Assert.IsTrue(receivedGrantMessage, "WhenSubscribedToAChannelGroup Grant access failed."));
                    EnqueueCallback(() =>
                            {
                                pubnub.PubnubUnitTest = null;
                                pubnub = null;
                            }
                        );
                    EnqueueTestComplete();
                });
        }
開發者ID:RecursosOnline,項目名稱:c-sharp,代碼行數:32,代碼來源:WhenSubscribedToAChannelGroup.cs

示例6: Init

        public void Init()
        {
            if (!PubnubCommon.PAMEnabled)
            {
                EnqueueTestComplete();
                return;
            }

            receivedGrantMessage = false;

            Pubnub pubnub = new Pubnub(PubnubCommon.PublishKey, PubnubCommon.SubscribeKey, PubnubCommon.SecretKey, "", false);

            PubnubUnitTest unitTest = new PubnubUnitTest();
            unitTest.TestClassName = "GrantRequestUnitTest";
            unitTest.TestCaseName = "Init";
            pubnub.PubnubUnitTest = unitTest;

            string channel = "hello_my_channel,hello_my_channel1,hello_my_channel2";

            EnqueueCallback(() => pubnub.GrantAccess<string>(channel, true, true, 20, ThenSubscribeInitializeShouldReturnGrantMessage, DummyErrorCallback));
            //Thread.Sleep(1000);

            EnqueueConditional(() => grantInitCallbackInvoked);

            EnqueueCallback(() => Assert.IsTrue(receivedGrantMessage, "WhenSubscribedToAChannel Grant access failed."));
            EnqueueTestComplete();
        }
開發者ID:Evgeniy20,項目名稱:c-sharp,代碼行數:27,代碼來源:WhenSubscribedToAChannel.cs

示例7: ThenSubKeyLevelWithReadShouldReturnSuccess

        public void ThenSubKeyLevelWithReadShouldReturnSuccess()
        {
            grantAccessCallbackInvoked = false;

            currentUnitTestCase = "ThenSubKeyLevelWithReadShouldReturnSuccess";

            receivedGrantMessage = false;

            Pubnub pubnub = new Pubnub(PubnubCommon.PublishKey, PubnubCommon.SubscribeKey, PubnubCommon.SecretKey, "", false);

            PubnubUnitTest unitTest = new PubnubUnitTest();
            unitTest.TestClassName = "WhenGrantIsRequested";
            unitTest.TestCaseName = "ThenSubKeyLevelWithReadShouldReturnSuccess";
            pubnub.PubnubUnitTest = unitTest;
            if (PubnubCommon.PAMEnabled)
            {
                EnqueueCallback(() => pubnub.GrantAccess<string>("", true, false, 5, AccessToSubKeyLevelCallback, DummyErrorCallback));
                //Thread.Sleep(1000);

                EnqueueConditional(() => grantAccessCallbackInvoked);

                EnqueueCallback(() => Assert.IsTrue(receivedGrantMessage, "WhenGrantIsRequested -> ThenSubKeyLevelWithReadShouldReturnSuccess failed."));
            }
            else
            {
                EnqueueCallback(() => Assert.Inconclusive("PAM Not Enabled for WhenGrantIsRequested -> ThenSubKeyLevelWithReadShouldReturnSuccess."));
            }
            EnqueueTestComplete();
        }
開發者ID:Evgeniy20,項目名稱:c-sharp,代碼行數:29,代碼來源:WhenGrantIsRequested.cs

示例8: ThenChannelLevelShouldReturnSuccess

        public void ThenChannelLevelShouldReturnSuccess()
        {
            currentUnitTestCase = "ThenChannelLevelShouldReturnSuccess";

            receivedAuditMessage = false;
            mreAudit = new ManualResetEvent(false);

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

                    PubnubUnitTest unitTest = new PubnubUnitTest();
                    unitTest.TestClassName = "WhenAuditIsRequested";
                    unitTest.TestCaseName = "ThenChannelLevelShouldReturnSuccess";
                    pubnub.PubnubUnitTest = unitTest;

                    string channel = "hello_my_channel";

                    if (PubnubCommon.PAMEnabled)
                    {
                        EnqueueCallback(() => pubnub.AuditAccess<string>(channel, AccessToChannelLevelCallback, DummyErrorCallback));
                        mreAudit.WaitOne(310 * 1000);

                        EnqueueCallback(() => Assert.IsTrue(receivedAuditMessage, "WhenAuditIsRequested -> ThenChannelLevelShouldReturnSuccess failed."));
                    }
                    else
                    {
                        EnqueueCallback(() => Assert.Inconclusive("PAM Not Enabled for WhenAuditIsRequested -> ThenChannelLevelShouldReturnSuccess"));
                    }
                    EnqueueTestComplete();
                });
        }
開發者ID:jugalkishor-sujal,項目名稱:c-sharp,代碼行數:32,代碼來源:WhenAuditIsRequested.cs

示例9: ThenUnencryptPublishShouldReturnSuccessCodeAndInfo

        public void ThenUnencryptPublishShouldReturnSuccessCodeAndInfo()
        {
            isUnencryptPublished = false;
            Pubnub pubnub = new Pubnub("demo","demo","","",false);
            string channel = "hello_my_channel";
            string message = messageForUnencryptPublish;

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

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

            EnqueueCallback(() => 
            {
                if (!isUnencryptPublished)
                {
                    Assert.IsTrue(isUnencryptPublished, "Unencrypt Publish Failed");
                }
                else
                {
                    EnqueueCallback(() => pubnub.DetailedHistory<string>(channel, -1, unEncryptPublishTimetoken, -1, false, CaptureUnencryptDetailedHistoryCallback, DummyErrorCallback));
                    EnqueueConditional(() => isUnencryptCheck);
                    EnqueueCallback(() => Assert.IsTrue(isUnencryptDH, "Unable to match the successful unencrypt Publish"));
                }
            });

            EnqueueTestComplete();
        }
開發者ID:kaido42,項目名稱:c-sharp,代碼行數:31,代碼來源:WhenAMessageIsPublished.cs

示例10: ThenAddChannelShouldReturnSuccess

        public void ThenAddChannelShouldReturnSuccess()
        {
            currentUnitTestCase = "ThenAddChannelShouldReturnSuccess";

            receivedChannelGroupMessage = false;

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

                    PubnubUnitTest unitTest = new PubnubUnitTest();
                    unitTest.TestClassName = "WhenChannelGroupIsRequested";
                    unitTest.TestCaseName = "ThenAddChannelShouldReturnSuccess";
                    pubnub.PubnubUnitTest = unitTest;

                    channelGroupManualEvent = new ManualResetEvent(false);
                    string channelName = "hello_my_channel";

                    EnqueueCallback(() => pubnub.AddChannelsToChannelGroup<string>(new string[] { channelName }, channelGroupName, ChannelGroupCRUDCallback, DummyErrorCallback));
                    channelGroupManualEvent.WaitOne(310*1000);

                    EnqueueCallback(() => Assert.IsTrue(receivedChannelGroupMessage, "WhenChannelGroupIsRequested -> ThenAddChannelShouldReturnSuccess failed."));
                    EnqueueCallback(() =>
                            {
                                pubnub.PubnubUnitTest = null;
                                pubnub = null;
                            }
                        );
                    EnqueueTestComplete();
                });
        }
開發者ID:RecursosOnline,項目名稱:c-sharp,代碼行數:31,代碼來源:WhenChannelGroupIsRequested.cs

示例11: ThenItShouldReturnTimeStamp

        public void ThenItShouldReturnTimeStamp()
        {
            Pubnub pubnub = new Pubnub(PubnubCommon.PublishKey, PubnubCommon.SubscribeKey, "", "", false);
            PubnubUnitTest unitTest = new PubnubUnitTest();
            unitTest.TestClassName = "WhenGetRequestServerTime";
            unitTest.TestCaseName = "ThenItShouldReturnTimeStamp";
            pubnub.PubnubUnitTest = unitTest;

            EnqueueCallback(() => pubnub.Time<string>(ReturnTimeStampCallback, DummyErrorCallback));
            EnqueueConditional(() => isTimeStamp);
            EnqueueCallback(() => Assert.IsTrue(timeReceived, "time() Failed"));
            EnqueueTestComplete();
        }
開發者ID:Evgeniy20,項目名稱:c-sharp,代碼行數:13,代碼來源:WhenGetRequestServerTime.cs

示例12: DetailHistoryCount10ReverseTrueReturnsRecords

        public void DetailHistoryCount10ReverseTrueReturnsRecords()
        {
            message10ReverseTrueReceived = false;

            Pubnub pubnub = new Pubnub("demo", "demo", "", "", false);
            string channel = "my/channel";

            PubnubUnitTest unitTest = new PubnubUnitTest();
            unitTest.TestClassName = "WhenDetailedHistoryIsRequested";
            unitTest.TestCaseName = "DetailHistoryCount10ReverseTrueReturnsRecords";
            pubnub.PubnubUnitTest = unitTest;

            EnqueueCallback(() => pubnub.DetailedHistory<string>(channel, -1, -1, 10, true, DetailedHistoryCount10ReverseTrueCallback));
            EnqueueConditional(() => detailedHistoryCount10ReverseCallbackInvoked);
            EnqueueCallback(() => Assert.IsTrue(message10ReverseTrueReceived, "Detailed History Failed"));

            EnqueueTestComplete();
        }
開發者ID:Vlanta,項目名稱:c-sharp,代碼行數:18,代碼來源:WhenDetailedHistoryIsRequested.cs

示例13: ThenItShouldReturnTimeStamp

        public void ThenItShouldReturnTimeStamp()
        {
            mreTime = new ManualResetEvent(false);

            ThreadPool.QueueUserWorkItem((s) =>
                {
                    Pubnub pubnub = new Pubnub(PubnubCommon.PublishKey, PubnubCommon.SubscribeKey, "", "", false);
                    PubnubUnitTest unitTest = new PubnubUnitTest();
                    unitTest.TestClassName = "WhenGetRequestServerTime";
                    unitTest.TestCaseName = "ThenItShouldReturnTimeStamp";
                    pubnub.PubnubUnitTest = unitTest;

                    EnqueueCallback(() => pubnub.Time<string>(ReturnTimeStampCallback, DummyErrorCallback));
                    mreTime.WaitOne(310 * 1000);
                    EnqueueCallback(() => Assert.IsTrue(timeReceived, "time() Failed"));
                    EnqueueTestComplete();
                });
        }
開發者ID:jugalkishor-sujal,項目名稱:c-sharp,代碼行數:18,代碼來源:WhenGetRequestServerTime.cs

示例14: ThenNoExistChannelShouldReturnNotSubscribed

        public void ThenNoExistChannelShouldReturnNotSubscribed()
        {
            receivedNotSubscribedMessage = false;
            Pubnub pubnub = new Pubnub(PubnubCommon.PublishKey, PubnubCommon.SubscribeKey, "", "", false);

            PubnubUnitTest unitTest = new PubnubUnitTest();
            unitTest.TestClassName = "WhenUnsubscribedToAChannel";
            unitTest.TestCaseName = "ThenNoExistChannelShouldReturnNotSubscribed";

            pubnub.PubnubUnitTest = unitTest;

            string channel = "hello_my_channel";

            EnqueueCallback(() => pubnub.Unsubscribe<string>(channel, DummyMethodNoExistChannelUnsubscribeChannelUserCallback, DummyMethodNoExistChannelUnsubscribeChannelConnectCallback, DummyMethodNoExistChannelUnsubscribeChannelDisconnectCallback1, NoExistChannelErrorCallback));
            EnqueueConditional(() => nochannelUnsubscribeInvoked);
            EnqueueCallback(() => pubnub.EndPendingRequests());
            EnqueueCallback(() => Assert.IsTrue(receivedNotSubscribedMessage, "WhenUnsubscribedToAChannel --> ThenNoExistChannelShouldReturnNotSubscribed Failed"));
            EnqueueTestComplete();
        }
開發者ID:Evgeniy20,項目名稱:c-sharp,代碼行數:19,代碼來源:WhenUnsubscribedToAChannel.cs

示例15: ThenPresenceShouldReturnReceivedMessage

        public void ThenPresenceShouldReturnReceivedMessage()
        {
            receivedPresenceMessage = false;

            Pubnub pubnub = new Pubnub("demo", "demo", "", "", false);
            string channel = "hello_my_channel";

            PubnubUnitTest unitTest = new PubnubUnitTest();
            unitTest.TestClassName = "WhenAClientIsPresented";
            unitTest.TestCaseName = "ThenPresenceShouldReturnReceivedMessage";
            pubnub.PubnubUnitTest = unitTest;

            EnqueueCallback(() => pubnub.Presence<string>(channel, ThenPresenceShouldReturnMessage, PresenceDummyMethodForConnectCallback, DummyErrorCallback));
            EnqueueCallback(() => pubnub.Subscribe<string>(channel, DummyMethodForSubscribe, SubscribeDummyMethodForConnectCallback, DummyErrorCallback));
            EnqueueConditional(() => subscribeConnectStatusCallbackInvoked);
            EnqueueConditional(() => subscribeCallbackInvoked);
            EnqueueCallback(() => pubnub.EndPendingRequests());
            EnqueueConditional(() => presenceReturnMessageCallbackInvoked);
            EnqueueCallback(() => Assert.IsTrue(receivedPresenceMessage, "Presence message not received"));

            EnqueueTestComplete();
        }
開發者ID:kaido42,項目名稱:c-sharp,代碼行數:22,代碼來源:WhenAClientIsPresented.cs


注:本文中的PubnubSilverlight.UnitTest.PubnubUnitTest類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。