//GetChannels //Get All CG public void TestBuildGetChannelsForChannelGroupRequestCommon(bool allCg, bool ssl, string authKey) { string channelGroup = "channelGroup"; string channelGroupStr = "channel-group/"; if (allCg) { channelGroup = ""; channelGroupStr = "channel-group"; } string uuid = "customuuid"; PNConfiguration pnConfiguration = new PNConfiguration(); pnConfiguration.Origin = EditorCommon.Origin; pnConfiguration.SubscribeKey = EditorCommon.SubscribeKey; pnConfiguration.PublishKey = EditorCommon.PublishKey; pnConfiguration.Secure = ssl; pnConfiguration.CipherKey = "enigma"; pnConfiguration.LogVerbosity = PNLogVerbosity.BODY; pnConfiguration.PresenceTimeout = 60; pnConfiguration.PresenceInterval = 30; pnConfiguration.AuthKey = authKey; pnConfiguration.UUID = uuid; PubNubUnity pnUnity = new PubNubUnity(pnConfiguration, null, null); string authKeyString = ""; if (!string.IsNullOrEmpty(authKey)) { authKeyString = string.Format("&auth={0}", pnConfiguration.AuthKey); } Uri uri = BuildRequests.BuildGetChannelsForChannelGroupRequest("", channelGroup, allCg, pnUnity ); //http://ps.pndsn.com/v1/channel-registration/sub-key/demo-36/channel-group/channelGroup?add=addChannel1,%20addChannel2&uuid=customuuid&auth=authKey&pnsdk=PubNub-CSharp-UnityOSX%2F3.7 string expected = string.Format("http{0}://{1}/v1/channel-registration/sub-key/{2}/{8}{3}?uuid={5}{6}&pnsdk={7}", ssl?"s":"", pnConfiguration.Origin, EditorCommon.SubscribeKey, channelGroup, "", uuid, authKeyString, Utility.EncodeUricomponent(pnUnity.Version, PNOperationType.PNChannelsForGroupOperation, false, true), channelGroupStr ); string received = uri.OriginalString; EditorCommon.LogAndCompare(expected, received); }
//GetChannels //Get All CG public void TestBuildGetChannelsForChannelGroupRequestCommon(bool allCg, bool ssl, string authKey) { string channelGroup = "channelGroup"; string channelGroupStr = "channel-group/"; if (allCg) { channelGroup = ""; channelGroupStr = "channel-group"; } string uuid = "customuuid"; Pubnub pubnub = new Pubnub( Common.PublishKey, Common.SubscribeKey, "", "", ssl ); pubnub.AuthenticationKey = authKey; string authKeyString = ""; if (!string.IsNullOrEmpty(authKey)) { authKeyString = string.Format("&auth={0}", pubnub.AuthenticationKey); } Uri uri = BuildRequests.BuildGetChannelsForChannelGroupRequest("", channelGroup, allCg, uuid, ssl, pubnub.Origin, pubnub.AuthenticationKey, Common.SubscribeKey ); //http://pubsub.pubnub.com/v1/channel-registration/sub-key/demo-36/channel-group/channelGroup?add=addChannel1,%20addChannel2&uuid=customuuid&auth=authKey&pnsdk=PubNub-CSharp-UnityOSX%2F3.7 string expected = string.Format("http{0}://{1}/v1/channel-registration/sub-key/{2}/{8}{3}?uuid={5}{6}&pnsdk={7}", ssl?"s":"", pubnub.Origin, Common.SubscribeKey, channelGroup, "", uuid, authKeyString, Utility.EncodeUricomponent(PubnubUnity.Version, ResponseType.ChannelGroupGet, false, true), channelGroupStr ); string received = uri.OriginalString; Common.LogAndCompare(expected, received); }