Exemplo n.º 1
0
        public async Task <IReadOnlyList <Object> > getListOfTestUsers()
        {
            string token = await getAppToken();

            PropertySet parameters = new PropertySet();
            string      path       = "/" + TestAppId + FBSDKTestUsersPath;

            //Assert.IsNotNull(token);

            parameters.Add("access_token", Uri.EscapeUriString(token));

            FBPaginatedArray arr = new FBPaginatedArray(path, parameters,
                                                        new FBJsonClassFactory(FBTestUser.FromJson));

            FBResult result = await arr.First();

            //Assert.IsTrue(result.Succeeded);

            IReadOnlyList <Object> users = null;

            try
            {
                users = (IReadOnlyList <Object>)result.Object;
            }
            catch (InvalidCastException)
            {
                Assert.IsTrue(false, "Item returned is not expected type" +
                              " (IReadOnlyList<Object>)");
            }

            return(users);
        }
Exemplo n.º 2
0
        public async Task testListTestUsers()
        {
            string token = await getAppToken();

            PropertySet parameters = new PropertySet();
            string      path       = "/" + TestAppId + FBSDKTestUsersPath;

            Assert.IsNotNull(token);
            bool found = false;

            parameters.Add("access_token", Uri.EscapeUriString(token));

            //Ensure we have at least one test user!
            FBTestUser user = await createTestUser(parameters);

            FBPaginatedArray arr = new FBPaginatedArray(path, parameters,
                                                        new FBJsonClassFactory(FBTestUser.FromJson));

            FBResult result = await arr.First();

            Assert.IsTrue(result.Succeeded);

            IReadOnlyList <Object> users =
                (IReadOnlyList <Object>)result.Object;

            Assert.IsTrue(users.Count > 0);

            for (int i = 0; i < users.Count; i++)
            {
                try
                {
                    FBTestUser testuser = (FBTestUser)users[i];
                    if (string.CompareOrdinal(testuser.Id, user.Id) == 0)
                    {
                        found = true;
                    }
                }
                catch (InvalidCastException)
                {
                    Assert.IsTrue(false, "Item returned is not expected type" +
                                  " (FBTestUser)");
                }
            }

            Assert.IsTrue(found);

            await deleteTestUser(user);
        }
Exemplo n.º 3
0
        public async void GetUserLikes()
        {
            if (FBSession.ActiveSession.LoggedIn)
            {
                string graphPath = FBSession.ActiveSession.User.Id + "/likes";

                FBJsonClassFactory fact = new FBJsonClassFactory(
                    (JsonText) => MyFBPage.FromJson(JsonText));

                _likes = new FBPaginatedArray(graphPath, null, fact);
                FBResult result = await _likes.First();

                if (result.Succeeded)
                {
                    IReadOnlyList <object> pages =
                        (IReadOnlyList <object>)result.Object;
                    AddLikes(pages);
                }
            }
        }
Exemplo n.º 4
0
        public async void GetUserLikes()
        {
            if (FBSession.ActiveSession.LoggedIn)
            {
                string graphPath = FBSession.ActiveSession.User.Id + "/likes";
                
                FBJsonClassFactory fact = new FBJsonClassFactory(
                    (JsonText) => MyFBPage.FromJson(JsonText));

                _likes = new FBPaginatedArray(graphPath, null, fact);
                FBResult result = await _likes.First();
                if (result.Succeeded)
                {
                    IReadOnlyList<object> pages = 
                        (IReadOnlyList<object>)result.Object;
                    AddLikes(pages);
                }
            }
        }
Exemplo n.º 5
0
        public async Task testListTestUsers()
        {
            string token = await getAppToken();
            PropertySet parameters = new PropertySet();
            string path = "/" + TestAppId + FBSDKTestUsersPath;
            Assert.IsNotNull(token);
            bool found = false;

            parameters.Add("access_token", Uri.EscapeUriString(token));

            //Ensure we have at least one test user!
            FBTestUser user = await createTestUser(parameters);
            
            FBPaginatedArray arr = new FBPaginatedArray(path, parameters,
                new FBJsonClassFactory(FBTestUser.FromJson));

            FBResult result = await arr.First();
            Assert.IsTrue(result.Succeeded);

            IReadOnlyList<Object> users = 
                (IReadOnlyList<Object>)result.Object;

            Assert.IsTrue(users.Count > 0);

            for (int i = 0; i < users.Count; i++)
            {
                try
                {
                    FBTestUser testuser = (FBTestUser)users[i];
                    if (string.CompareOrdinal(testuser.Id, user.Id) == 0)
                    {
                        found = true;
                    }
                }
                catch (InvalidCastException)
                {
                    Assert.IsTrue(false, "Item returned is not expected type" +
                        " (FBTestUser)");
                }
            }

            Assert.IsTrue(found);

            await deleteTestUser(user);
        }
Exemplo n.º 6
0
        public async Task<IReadOnlyList<Object>> getListOfTestUsers()
        {
            string token = await getAppToken();
            PropertySet parameters = new PropertySet();
            string path = "/" + TestAppId + FBSDKTestUsersPath;
            //Assert.IsNotNull(token);

            parameters.Add("access_token", Uri.EscapeUriString(token));

            FBPaginatedArray arr = new FBPaginatedArray(path, parameters,
                new FBJsonClassFactory(FBTestUser.FromJson));

            FBResult result = await arr.First();
            //Assert.IsTrue(result.Succeeded);

            IReadOnlyList<Object> users = null;

            try
            {
                users = (IReadOnlyList<Object>)result.Object; 
            }
            catch (InvalidCastException)
            {
                Assert.IsTrue(false, "Item returned is not expected type" +
                    " (IReadOnlyList<Object>)");
            }

            return users;
        }