Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
 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);
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
        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);
        }
Ejemplo n.º 6
0
 public void Test()
 {
     // The AndroidTest class should be available but it is not.
     var test = new AndroidTest();
 }
Ejemplo n.º 7
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);
        }
Ejemplo n.º 8
0
        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);
        }
Ejemplo n.º 9
0
        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);
        }