public void ThenItShouldReturnReceivedMessage() { string status = ""; Pubnub pubnub = new Pubnub ( "demo", "demo", "", "", false); string channel = "hello_world"; Common.deliveryStatus = false; pubnub.subscribe (channel, Common.DisplayReturnMessage); while (!Common.deliveryStatus); string strResponse = ""; Console.WriteLine (Common.objResponse); if (Common.objResponse.Equals (null)) { Assert.Fail("Null response"); } else { IList<object> fields = Common.objResponse as IList<object>; foreach (object lst in fields) { strResponse = lst.ToString (); Console.WriteLine (strResponse); Assert.IsNotEmpty (strResponse); } } }
public void ThenItShouldReturnReceivedMessage() { string status = ""; Pubnub pubnub = new Pubnub ( "demo", "demo", "", "", false); string channel = "hello_world"; bool responseStatus = false; List<object> lstSubscribe = null; pubnub.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e) { if (e.PropertyName == "Subscribe") { lstSubscribe = ((Pubnub)sender).Subscribe; responseStatus = true; } }; pubnub.subscribe (channel); while (!responseStatus) ; string strResponse = ""; Console.WriteLine (lstSubscribe); if (lstSubscribe.Equals (null)) { Assert.Fail("Null response"); } else { foreach (object lst in lstSubscribe) { strResponse = lst.ToString (); Console.WriteLine (strResponse); Assert.IsNotEmpty (strResponse); } } }