public void TestAndroidDeferredAppLink()
        {
            var test = new AndroidTest<IAppLinkResult>();
            var result = new Dictionary<string, object>();
            result[Constants.CallbackIdKey] = "1";
            result[Constants.RefKey] = "test ref";
            result[Constants.TargetUrlKey] = "test target url";
            result[Constants.ExtrasKey] = new Dictionary<string, object>()
            {
                {
                    "com.facebook.platform.APPLINK_NATIVE_CLASS", string.Empty
                },
                {
                    "target_url", result[Constants.TargetUrlKey]
                }
            };

            test.ExpectedResult = result;

            test.CallbackResultValidator = appLinkResult =>
            {
                Assert.IsNotNull(appLinkResult.Extras);
                Assert.IsNotNull(appLinkResult.Ref);
                Assert.IsNotNull(appLinkResult.TargetUrl);
                Assert.IsNull(appLinkResult.Url);
            };

            test.Run(
                (callback) => test.AndroidFacebook.FetchDeferredAppLink(callback),
                test.AndroidFacebook.OnFetchDeferredAppLinkComplete);
        }
 public void TestSimpleAppInvite()
 {
     var test = new AndroidTest<IAppInviteResult>();
     var result = new Dictionary<string, object>();
     result[Constants.CallbackIdKey] = "1";
     test.ExpectedResult = result;
     test.Run(
         (callback) => test.AndroidFacebook.AppInvite(null, null, callback),
         test.AndroidFacebook.OnAppInviteComplete);
 }
Beispiel #3
0
        public void BasicLoginWithReadTest()
        {
            AccessToken.CurrentAccessToken = null;
            var test = new AndroidTest<ILoginResult>();
            var result = this.GetBaseTokenResult();
            test.ExpectedResult = result;

            test.Run(
                (callback) => test.AndroidFacebook.LogInWithReadPermissions(null, callback),
                test.AndroidFacebook.OnLoginComplete);
            this.AssertResultDicMatchesToken(result, AccessToken.CurrentAccessToken);
        }
        public void SimpleLinkShare()
        {
            var test = new AndroidTest<IShareResult>();
            var result = new Dictionary<string, object>();
            result[Constants.CallbackIdKey] = "1";
            result["id"] = "123456789";
            test.ExpectedResult = result;
            test.CallbackResultValidator = (shareResult) =>
            {
                Assert.AreEqual(result["id"], shareResult.PostId);
            };

            test.Run(
                (callback) => test.AndroidFacebook.ShareLink(
                    new Uri("http://www.test.com/"),
                    "test title",
                    "test description",
                    new Uri("http://www.photo.com/"),
                    callback),
                test.AndroidFacebook.OnShareLinkComplete);
        }
        public void TestAndroidAppLink()
        {
            var test = new AndroidTest<IAppLinkResult>();
            var result = new Dictionary<string, object>();
            result[Constants.CallbackIdKey] = "1";
            result[Constants.UrlKey] = "test url";

            test.ExpectedResult = result;

            test.CallbackResultValidator = appLinkResult =>
            {
                Assert.AreEqual(result[Constants.UrlKey], appLinkResult.Url);
                Assert.IsNull(appLinkResult.Ref);
                Assert.IsNull(appLinkResult.TargetUrl);
                Assert.IsNull(appLinkResult.Extras);
            };

            test.Run(
                (callback) => test.AndroidFacebook.GetAppLink(callback),
                test.AndroidFacebook.OnGetAppLinkComplete);
        }
Beispiel #6
0
        public void TestMaxInt64ExpiredTime()
        {
            AccessToken.CurrentAccessToken = null;
            var test = new AndroidTest<ILoginResult>();
            var result = this.GetBaseTokenResult();
            result[LoginResult.ExpirationTimestampKey] = "9223372036854775";
            test.ExpectedResult = result;

            test.Run(
                (callback) => test.AndroidFacebook.LogInWithReadPermissions(null, callback),
                test.AndroidFacebook.OnLoginComplete);

            // Check to make sure the access token is set
            var expected = new Dictionary<string, object>(result);
            expected[LoginResult.ExpirationTimestampKey] = DateTime.MaxValue.TimeInSeconds().ToString();
            this.AssertResultDicMatchesToken(expected, AccessToken.CurrentAccessToken);
        }
        public void TestAndroidEmptyDefferedAppLink()
        {
            var test = new AndroidTest<IAppLinkResult>();
            var result = new Dictionary<string, object>();
            result[Constants.CallbackIdKey] = "1";
            result["did_complete"] = true;
            test.ExpectedResult = result;

            test.Run(
                (callback) => test.AndroidFacebook.FetchDeferredAppLink(callback),
                test.AndroidFacebook.OnFetchDeferredAppLinkComplete);
        }
        public void TestAndroidSimpleDeepLink()
        {
            var test = new AndroidTest<IAppLinkResult>();
            var result = new Dictionary<string, object>();
            result[Constants.CallbackIdKey] = "1";
            result[Constants.UrlKey] = "test url";
            result[Constants.RefKey] = "test ref";
            result[Constants.TargetUrlKey] = "test target url";
            result[Constants.ExtrasKey] = new Dictionary<string, object>()
            {
                {
                    "extras", new Dictionary<string, object>()
                },
                {
                    "version", "1.0"
                }
            };

            test.ExpectedResult = result;

            test.CallbackResultValidator = appLinkResult =>
            {
                Assert.AreEqual(result[Constants.UrlKey], appLinkResult.Url);
                Assert.AreEqual(result[Constants.RefKey], appLinkResult.Ref);
                Assert.AreEqual(result[Constants.TargetUrlKey], appLinkResult.TargetUrl);
                Assert.AreEqual(
                    MiniJSON.Json.Serialize(result[Constants.ExtrasKey]),
                    MiniJSON.Json.Serialize(appLinkResult.Extras));
            };

            test.Run(
                (callback) => test.AndroidFacebook.GetAppLink(callback),
                test.AndroidFacebook.OnGetAppLinkComplete);
        }