internal Builder(KiiPushMessageData messageData) { this.mParent = new JsonObject(); this.mMessageData = messageData; this.mGcm = GCMMessage.CreateBuilder().Build().ToJson(); this.mApns = APNSMessage.CreateBuilder().Build().ToJson(); this.mMqtt = MqttMessage.CreateBuilder().Build().ToJson(); }
public void Test_0003_APNSMessage() { APNSData data = new APNSData(); data.Put("payload", "abc"); APNSMessage apns = APNSMessage.CreateBuilder() .WithAPNSData(data) .WithAlertActionLocKey("ActionLocKey") .WithAlertBody("Body") .WithAlertLaunchImage("LaunchImage") .WithAlertLocArgs(new string[] { "Args1", "Args2" }) .WithAlertLocKey("LocKey") .WithAlertTitle("title") .WithAlertSubtitle("subtitle") .WithBadge(3) .WithContentAvailable(1) .WithSound("Sound") .WithMutableContent(1) .Build(); JsonObject json = apns.ToJson(); Assert.AreEqual(true, json.Get("enabled")); Assert.AreEqual(3, json.Get("badge")); Assert.AreEqual(1, json.Get("contentAvailable")); Assert.AreEqual(1, json.Get("mutableContent")); Assert.AreEqual("Sound", json.Get("sound")); Assert.AreEqual("abc", json.GetJsonObject("data").Get("payload")); Assert.AreEqual("ActionLocKey", json.GetJsonObject("alert").Get("actionLocKey")); Assert.AreEqual("title", json.GetJsonObject("alert").Get("title")); Assert.AreEqual("subtitle", json.GetJsonObject("alert").Get("subtitle")); Assert.AreEqual("Body", json.GetJsonObject("alert").Get("body")); Assert.AreEqual("LaunchImage", json.GetJsonObject("alert").Get("launchImage")); Assert.AreEqual("Args1", json.GetJsonObject("alert").GetJsonArray("locArgs").Get(0)); Assert.AreEqual("Args2", json.GetJsonObject("alert").GetJsonArray("locArgs").Get(1)); Assert.AreEqual("LocKey", json.GetJsonObject("alert").Get("locKey")); }
public void Test_BuildWithNullSound() { APNSMessage.CreateBuilder().WithSound(null); }
public void Test_BuildWithNullAPNSData() { APNSMessage.CreateBuilder().WithAPNSData(null); }
public void Test_BuildWithNullAlertLocKey() { APNSMessage.CreateBuilder().WithAlertLocKey(null); }
public void Test_BuildWithNullAlertLaunchImage() { APNSMessage.CreateBuilder().WithAlertLaunchImage(null); }