public IEnumerator FetchAsyncAuthenticationError() { // テストデータ作成 NCMBUser.LogInAsync("tarou", "tarou", (e) => { Assert.Null(e); NCMBUser.CurrentUser.SessionToken = "invalidToken"; NCMBUser.CurrentUser._currentOperations.Clear(); NCMBPush push = new NCMBPush(); push.ObjectId = "pushDummyObjectId"; push.FetchAsync((NCMBException ex) => { Assert.NotNull(ex); Assert.AreEqual("E401001", ex.ErrorCode); Assert.AreEqual("Authentication error by header incorrect.", ex.ErrorMessage); NCMBTestSettings.CallbackFlag = true; }); }); yield return(NCMBTestSettings.AwaitAsync()); // 登録成功の確認 Assert.True(NCMBTestSettings.CallbackFlag); }
/// <summary> /// プッシュの送信を行います。 /// </summary> public static IObservable <NCMBPush> SendPushAsync(this NCMBPush origin) { return(Observable.Create <NCMBPush>(observer => { var gate = new object(); var isDisposed = false; origin.SendPush(error => { lock (gate) { if (isDisposed) { return; } if (error == null) { observer.OnNext(origin); observer.OnCompleted(); } else { observer.OnError(error); } } }); return Disposable.Create(() => { lock (gate) { isDisposed = true; } }); })); }
public void SendPush() { NCMBPush push = new NCMBPush(); push.Message = "杏鈴「おはろーございます!!にーさん!!\n5分前なんですから起きてください!」"; push.PushToAndroid = true; push.SendPush(); }
public void GetBaseUrlTest() { // テストデータ作成 NCMBPush push = new NCMBPush(); // internal methodの呼び出し MethodInfo method = push.GetType().GetMethod("_getBaseUrl", BindingFlags.NonPublic | BindingFlags.Instance); Assert.AreEqual("http://localhost:3000/2013-09-01/push", method.Invoke(push, null).ToString()); }
public void SendPush() { NCMBPush push = new NCMBPush(); push.Title = "Unity normal notification"; push.Message = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); push.ContentAvailable = true; push.BadgeIncrementFlag = false; push.ImmediateDeliveryFlag = true; push.SendPush(); }
public void SendRichPush() { NCMBPush push = new NCMBPush(); push.Title = "Unity rich notification"; push.Message = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); push.ContentAvailable = true; push.BadgeIncrementFlag = false; push.ImmediateDeliveryFlag = true; push.RichUrl = "https://google.com"; push.SendPush(); }
/// <summary> /// プッシュの送信を行います。 /// </summary> public static Task <NCMBPush> SendPushTaskAsync(this NCMBPush origin) { var tcs = new TaskCompletionSource <NCMBPush>(); origin.SendPush(error => { if (error != null) { tcs.SetException(error); } else { tcs.SetResult(origin); } }); return(tcs.Task); }
public void searchConditionTest() { // 絞り込み条件 Dictionary <string, IDictionary> searchCondition = new Dictionary <string, IDictionary> () { { "score", new Dictionary <string, int> () { { "$gte", 1000 }, { "$lte", 3000 } } } }; NCMBPush push = new NCMBPush(); push.SearchCondition = searchCondition; Assert.AreEqual(1000, ((IDictionary)((IDictionary)push.SearchCondition) ["score"]) ["$gte"]); Assert.AreEqual(3000, ((IDictionary)((IDictionary)push.SearchCondition) ["score"]) ["$lte"]); }
public IEnumerator FetchAsyncDataNotAvailable() { // テストデータ作成 NCMBPush push = new NCMBPush(); push.ObjectId = "pushInvalidObjectId"; push.FetchAsync((NCMBException ex) => { Assert.NotNull(ex); Assert.AreEqual("E404001", ex.ErrorCode); Assert.AreEqual("No data available.", ex.ErrorMessage); NCMBTestSettings.CallbackFlag = true; }); yield return(NCMBTestSettings.AwaitAsync()); // 登録成功の確認 Assert.True(NCMBTestSettings.CallbackFlag); }