예제 #1
0
        public void PushChannel(string message, string channelId, IComparable badge)
        {
            //Assert.That(!string.IsNullOrWhiteSpace(message));
            Assert.That(!string.IsNullOrWhiteSpace(channelId));

            if (!CHL_TK.IsMatch(channelId))
            {
                string ch = ServiceModelConfig.GetConfigValue(channelId);
                Assert.That(CHL_TK.IsMatch(ch), "Invalid UA Channel Id: {0} => {1}", channelId, ch);
                channelId = ch;
            }

            var p = new Push(new Audience(Type.AudienceType.Ios, channelId, true), message);

            p.Notification.IosAlert = new IosAlert {
                Badge = badge
            };

            PushResponse pv = _ua.Validate(p);

            TestResponse(pv);

            PushResponse pr = _ua.Push(p);

            TestResponse(pr);
            CollectionAssert.IsNotEmpty(pr.PushIds);
        }
예제 #2
0
        public void PushToken(string message, string iosDeviceToken, IComparable badge)
        {
            //Assert.That(!string.IsNullOrWhiteSpace(message));
            Assert.That(!string.IsNullOrWhiteSpace(iosDeviceToken));

            if (!DEV_TK.IsMatch(iosDeviceToken))
            {
                string tk = ServiceModelConfig.GetConfigValue(iosDeviceToken);
                Assert.That(DEV_TK.IsMatch(tk), "Invalid iOS Device Token: {0} => {1}", iosDeviceToken, tk);
                iosDeviceToken = tk;
            }

            var p = new Push(new Audience(Type.AudienceType.Ios, iosDeviceToken), message);

            p.Notification.IosAlert = new IosAlert {
                Badge = badge
            };

            PushResponse pv = _ua.Validate(p);

            TestResponse(pv);

            PushResponse pr = _ua.Push(p);

            TestResponse(pr);
            CollectionAssert.IsNotEmpty(pr.PushIds);
        }