public void Test_Delete_By_Anonymous() { this.LogIn(); ClearClientRequest(); client.AddResponse(200, null); KiiTopic topic = KiiUser.CurrentUser.Topic("my_topic"); Kii.LogOut(); topic.Delete(); }
public void Test_Save_By_Anonymous() { this.LogIn(); ClearClientRequest(); client.AddResponse(new CloudException(401, null)); KiiTopic topic = KiiUser.CurrentUser.Topic("my_topic"); Kii.LogOut(); try { topic.Save(); Assert.Fail("CloudException has not thrown"); } catch (CloudException e) { // pass } Assert.AreEqual(KiiHttpMethod.PUT, client.RequestMethod [0]); Assert.AreEqual("https://api.kii.com/api/apps/appId/users/user1234/topics/my_topic", client.RequestUrl [0]); }
public void Test_SendMessage_Anonymous() { this.LogIn(); ClearClientRequest(); client.AddResponse(new CloudException(401, null)); KiiPushMessageData data = new KiiPushMessageData(); data.Put("payload", "abc"); KiiPushMessage message = KiiPushMessage.BuildWith(data).Build(); KiiTopic topic = KiiUser.CurrentUser.Topic("my_topic"); Kii.LogOut(); try { topic.SendMessage(message); Assert.Fail("CloudException has not thrown"); } catch (CloudException e) { // pass } Assert.AreEqual(KiiHttpMethod.POST, client.RequestMethod [0]); Assert.AreEqual("{\"data\":{\"payload\":\"abc\"},\"gcm\":{\"enabled\":true},\"apns\":{\"enabled\":true},\"mqtt\":{\"enabled\":true}}", client.RequestBody [0]); Assert.AreEqual("https://api.kii.com/api/apps/appId/users/user1234/topics/my_topic/push/messages", client.RequestUrl [0]); }