public void TestBuildLeaveRequestCommon(string[] channels, string[] channelGroups, bool ssl, string authKey) { 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.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); } string cgStr = ""; string cg = ""; if (channelGroups != null) { cg = string.Join(",", channelGroups); cgStr = string.Format("&channel-group={0}", Utility.EncodeUricomponent(cg, PNOperationType.PNLeaveOperation, true, false)); } string chStr = ","; string ch = ""; if (channels != null) { ch = string.Join(",", channels); chStr = ch; } Uri uri = BuildRequests.BuildLeaveRequest(ch, cg, pnUnity); //https://ps.pndsn.com/v2/presence/sub_key/demo-36/channel/test/leave?uuid=customuuid&auth=authKey&pnsdk=PubNub-CSharp-UnityIOS/3.6.9.0 string expected = string.Format("http{0}://{1}/v2/presence/sub_key/{2}/channel/{3}/leave?uuid={4}{7}{5}&pnsdk={6}", ssl?"s":"", pnConfiguration.Origin, EditorCommon.SubscribeKey, chStr, uuid, authKeyString, Utility.EncodeUricomponent(pnUnity.Version, PNOperationType.PNLeaveOperation, false, true), cgStr ); string received = uri.OriginalString; EditorCommon.LogAndCompare(expected, received); }