public void ThenComplexMessageObjectShouldReturnSuccessCodeAndInfo() { ThreadPool.QueueUserWorkItem((s) => { isComplexObjectPublished = false; Pubnub pubnub = new Pubnub(PubnubCommon.PublishKey, PubnubCommon.SubscribeKey, "", "", false); PubnubUnitTest unitTest = new PubnubUnitTest(); unitTest.TestClassName = "WhenAMessageIsPublished"; unitTest.TestCaseName = "ThenComplexMessageObjectShouldReturnSuccessCodeAndInfo"; pubnub.PubnubUnitTest = unitTest; string channel = "hello_my_channel"; object message = new PubnubDemoObject(); messageComplexObjectForPublish = JsonConvert.SerializeObject(message); mrePublish = new ManualResetEvent(false); pubnub.Publish <string>(channel, message, ReturnSuccessComplexObjectPublishCodeCallback, DummyErrorCallback); mrePublish.WaitOne(60 * 1000); if (!isComplexObjectPublished) { Deployment.Current.Dispatcher.BeginInvoke(() => { Assert.IsTrue(isComplexObjectPublished, "Complex Object Publish Failed"); pubnub.PubnubUnitTest = null; pubnub = null; TestComplete(); }); } else { mreDetailedHistory = new ManualResetEvent(false); pubnub.DetailedHistory <string>(channel, -1, complexObjectPublishTimetoken, -1, false, CaptureComplexObjectDetailedHistoryCallback, DummyErrorCallback); mreDetailedHistory.WaitOne(60 * 1000); Deployment.Current.Dispatcher.BeginInvoke(() => { Assert.IsTrue(isComplexObjectDetailedHistory, "Unable to match the successful unencrypt object Publish"); pubnub.PubnubUnitTest = null; pubnub = null; TestComplete(); }); } }); }
public void ThenComplexMessageObjectShouldReturnSuccessCodeAndInfo() { ThreadPool.QueueUserWorkItem((s) => { isComplexObjectPublished = false; Pubnub pubnub = new Pubnub("demo", "demo", "", "", false); PubnubUnitTest unitTest = new PubnubUnitTest(); unitTest.TestClassName = "WhenAMessageIsPublished"; unitTest.TestCaseName = "ThenComplexMessageObjectShouldReturnSuccessCodeAndInfo"; pubnub.PubnubUnitTest = unitTest; string channel = "my/channel"; object message = new PubnubDemoObject(); messageComplexObjectForPublish = JsonConvert.SerializeObject(message); pubnub.Publish<string>(channel, message, ReturnSuccessComplexObjectPublishCodeCallback); mreComplexObjectPublish.WaitOne(310 * 1000); if (!isComplexObjectPublished) { Deployment.Current.Dispatcher.BeginInvoke(() => { Assert.IsTrue(isComplexObjectPublished, "Complex Object Publish Failed"); TestComplete(); }); } else { pubnub.DetailedHistory<string>(channel, -1, complexObjectPublishTimetoken, -1, false, CaptureComplexObjectDetailedHistoryCallback); mreComplexObjectDetailedHistory.WaitOne(310 * 1000); Deployment.Current.Dispatcher.BeginInvoke(() => { Assert.IsTrue(isComplexObjectDetailedHistory, "Unable to match the successful unencrypt object Publish"); TestComplete(); }); } }); }
public void ThenComplexMessageObjectShouldReturnSuccessCodeAndInfo() { isComplexObjectPublished = false; Pubnub pubnub = new Pubnub(PubnubCommon.PublishKey, PubnubCommon.SubscribeKey, "", "", false); PubnubUnitTest unitTest = new PubnubUnitTest(); unitTest.TestClassName = "WhenAMessageIsPublished"; unitTest.TestCaseName = "ThenComplexMessageObjectShouldReturnSuccessCodeAndInfo"; pubnub.PubnubUnitTest = unitTest; string channel = "hello_my_channel"; object message = new PubnubDemoObject(); messageComplexObjectForPublish = JsonConvert.SerializeObject(message); pubnub.Publish<string>(channel, message, ReturnSuccessComplexObjectPublishCodeCallback, DummyErrorCallback); mreComplexObjectPublish.WaitOne(310 * 1000); if (!isComplexObjectPublished) { Assert.IsTrue(isComplexObjectPublished, "Complex Object Publish Failed"); } else { pubnub.DetailedHistory<string>(channel, -1, complexObjectPublishTimetoken, -1, false, CaptureComplexObjectDetailedHistoryCallback, DummyErrorCallback); mreComplexObjectDetailedHistory.WaitOne(310 * 1000); Assert.IsTrue(isComplexObjectDetailedHistory, "Unable to match the successful unencrypt object Publish"); } }