示例#1
0
    public void LogInWithAuthDataAsyncFacebook()
    {
        // テストデータ作成
        NCMBUser user = new NCMBUser();

        user.AuthData = facebookParams.param;

        // authData登録
        user.LogInWithAuthDataAsync((NCMBException e) => {
            Assert.Null(e);
            NCMBTestSettings.CallbackFlag = true;
        });
        NCMBTestSettings.AwaitAsync();

        Assert.AreEqual("dummyObjectId", user.ObjectId);

        // facebookパラメータ確認
        Dictionary <string, object> authData = user.GetAuthDataForProvider("facebook");

        Assert.AreEqual("facebookDummyId", authData["id"]);
        Assert.AreEqual("facebookDummyAccessToken", authData["access_token"]);
        Assert.AreEqual("2017-02-07T01:02:03.004Z", authData["expiration_date"]);

        // 登録成功の確認
        Assert.IsNotEmpty(NCMBUser._getCurrentSessionToken());
        Assert.True(user.IsLinkWith("facebook"));
        Assert.True(NCMBTestSettings.CallbackFlag);
        NCMBUser.LogOutAsync();
    }
示例#2
0
    public void LogInWithAuthDataAsyncTwitter()
    {
        // テストデータ作成
        NCMBUser user = new NCMBUser();

        user.AuthData = twitterParams.param;

        // authData登録
        user.LogInWithAuthDataAsync((NCMBException e) => {
            Assert.Null(e);
            NCMBTestSettings.CallbackFlag = true;
        });
        NCMBTestSettings.AwaitAsync();

        Assert.AreEqual("dummyObjectId", user.ObjectId);

        // twitterパラメータ確認
        Dictionary <string, object> authData = user.GetAuthDataForProvider("twitter");

        Assert.AreEqual("twitterDummyId", authData["id"]);
        Assert.AreEqual("twitterDummyScreenName", authData["screen_name"]);
        Assert.AreEqual("twitterDummyConsumerKey", authData["oauth_consumer_key"]);
        Assert.AreEqual("twitterDummyConsumerSecret", authData["consumer_secret"]);
        Assert.AreEqual("twitterDummyAuthToken", authData["oauth_token"]);
        Assert.AreEqual("twitterDummyAuthSecret", authData["oauth_token_secret"]);

        // 登録成功の確認
        Assert.NotNull(NCMBUser._getCurrentSessionToken());
        Assert.True(user.IsLinkWith("twitter"));
        Assert.True(NCMBTestSettings.CallbackFlag);
        NCMBUser.LogOutAsync();
    }
示例#3
0
    public IEnumerator LogInWithAuthDataAsyncFacebookStatus200()
    {
        // テストデータ作成
        NCMBUser user = new NCMBUser();

        user.AuthData = facebookParams200.param;

        // authData登録
        user.LogInWithAuthDataAsync((NCMBException e1) => {
            Assert.Null(e1);
            NCMBUser currentUser = NCMBUser.CurrentUser;
            Assert.NotNull(currentUser);
            Assert.AreEqual("dummyObjectId", currentUser.ObjectId);

            // facebookパラメータ確認
            Dictionary <string, object> authData = currentUser.GetAuthDataForProvider("facebook");
            Assert.AreEqual("facebookDummyId200", authData ["id"]);
            Assert.AreEqual("facebookDummyAccessToken200", authData ["access_token"]);
            Assert.AreEqual("2017-02-07T01:02:03.004Z", authData ["expiration_date"]);

            // 登録成功の確認
            Assert.IsNotEmpty(NCMBUser._getCurrentSessionToken());
            Assert.True(currentUser.IsLinkWith("facebook"));
            NCMBTestSettings.CallbackFlag = true;
        });
        yield return(NCMBTestSettings.AwaitAsync());

        Assert.True(NCMBTestSettings.CallbackFlag);
    }