本文整理汇总了C#中Pubnub.history方法的典型用法代码示例。如果您正苦于以下问题:C# Pubnub.history方法的具体用法?C# Pubnub.history怎么用?C# Pubnub.history使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pubnub
的用法示例。
在下文中一共展示了Pubnub.history方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ThenItShouldReturnHistoryMessages
public void ThenItShouldReturnHistoryMessages()
{
Pubnub pubnub = new Pubnub(
"demo",
"demo",
"",
false
);
string channel = "my/channel";
pubnub.PropertyChanged += new PropertyChangedEventHandler(Pubnub_PropertyChanged);
pubnub.history(channel, 1);
}
示例2: ThenItShouldReturnHistoryMessages
public void ThenItShouldReturnHistoryMessages ()
{
Pubnub pubnub = new Pubnub (
"demo",
"demo",
"",
"",
false
);
string channel = "hello_world";
bool responseStatus = false;
//publish a test message.
Common cm = new Common();
cm.DeliveryStatus = false;
cm.Response = null;
pubnub.Publish (channel, "Test message", cm.DisplayReturnMessage, cm.DisplayErrorMessage);
List<object> lstHistory = null;
pubnub.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e) {
if (e.PropertyName == "History")
{
lstHistory = ((Pubnub)sender).History;
responseStatus = true;
}
};
pubnub.history(channel, 1);
/*while (!responseStatus) ;
string strResponse = "";
if (lstHistory.Equals (null)) {
Assert.Fail("Null response");
}
else
{
foreach(object lst in lstHistory)
{
strResponse = lst.ToString();
Console.WriteLine("resp:" + strResponse);
Assert.IsNotEmpty(strResponse);
}
}*/
}
示例3: TestUnencryptedHistory
public static void TestUnencryptedHistory()
{
Pubnub pubnub = new Pubnub(
"demo",
"demo",
"",
"",
false);
string channel = "my_channel";
Common cm = new Common();
cm.DeliveryStatus = false;
cm.Response = null;
string message = "Pubnub API Usage Example - Publish";
//pubnub.CIPHER_KEY = "enigma";
pubnub.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == "History")
{
Console.WriteLine("\n*********** History Messages *********** ");
cm.DeliveryStatus = true;
}
};
cm.DeliveryStatus = false;
pubnub.Publish(channel, message, cm.DisplayReturnMessage, cm.DisplayErrorMessage);
while (!cm.DeliveryStatus) ;
cm.DeliveryStatus = false;
pubnub.history(channel, 1);
while (!cm.DeliveryStatus) ;
if (pubnub.History[0].Equals (null)) {
Assert.Fail("Null response");
}
else
{
Assert.AreEqual(message, pubnub.History[0].ToString());
}
}