public IEnumerator FetchAsyncAuthenticationError()
    {
        // テストデータ作成
        NCMBUser.LogInAsync("tarou", "tarou", (e) => {
            Assert.Null(e);

            NCMBUser.CurrentUser.SessionToken = "invalidToken";
            NCMBUser.CurrentUser._currentOperations.Clear();

            NCMBInstallation installation = new NCMBInstallation();
            installation.ObjectId         = "instllDummyObjectId";

            installation.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);
    }
Exemplo n.º 2
0
    public void GetBaseUrlTest()
    {
        // テストデータ作成
        NCMBInstallation installation = new NCMBInstallation();

        // internal methodの呼び出し
        MethodInfo method = installation.GetType().GetMethod("_getBaseUrl", BindingFlags.NonPublic | BindingFlags.Instance);

        Assert.AreEqual("http://localhost:3000/2013-09-01/installations", method.Invoke(installation, null).ToString());
    }
Exemplo n.º 3
0
 public void TestCreateInstallation()
 {
     Task.Run(async() =>
     {
         var installation = new NCMBInstallation();
         await installation
         .Set("deviceToken", "aaa")
         .Set("deviceType", "ios")
         .Save();
         Assert.NotNull(installation.Get("objectId"));
         await installation.Delete();
     }).GetAwaiter().GetResult();
 }
Exemplo n.º 4
0
 public void TestCreateInstallationFail()
 {
     Task.Run(async() =>
     {
         var installation = new NCMBInstallation();
         try
         {
             installation
             .Set("deviceType", "ios");
             await installation.Save();
             Assert.AreEqual(true, false);
         }
         catch (Exception e)
         {
             Assert.AreEqual(e.Message, "deviceToken is required.");
         }
     }).GetAwaiter().GetResult();
 }
    public IEnumerator FetchAsyncDataNotAvailable()
    {
        // テストデータ作成
        NCMBInstallation installation = new NCMBInstallation();

        installation.ObjectId = "instllInvalidObjectId";

        installation.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);
    }
Exemplo n.º 6
0
 public void TestFetchInstallations()
 {
     Task.Run(async() =>
     {
         var ary = new string[3] {
             "aaa", "bbb", "ccc"
         };
         foreach (var deviceToken in ary)
         {
             var installation = new NCMBInstallation();
             await installation
             .Set("deviceToken", deviceToken)
             .Set("deviceType", "ios")
             .Save();
         }
         var query         = NCMBInstallation.Query();
         var installations = await query.FetchAll();
         Assert.AreEqual(3, installations.Length);
         foreach (var installation in installations)
         {
             await installation.Delete();
         }
     }).GetAwaiter().GetResult();
 }