本文整理汇总了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();
});
}
示例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();
}
示例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();
});
}
示例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();
});
}
示例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();
});
}
示例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();
}
示例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();
}
示例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();
});
}
示例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();
}
示例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();
});
}
示例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();
}
示例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();
}
示例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();
});
}
示例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();
}
示例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();
}