public void publish_photo_to_application_album()
        {
            #if DEBUG
            string photoPath = @"..\..\..\Funtown.Tests\bin\Debug\monkey.jpg";
            #else
            string photoPath = @"..\..\..\Funtown.Tests\bin\Release\monkey.jpg";
            #endif

            byte[] photo = File.ReadAllBytes(photoPath);
            FuntownClient app = new FuntownClient();
            dynamic parameters = new ExpandoObject();
            parameters.access_token = ConfigurationManager.AppSettings["AccessToken"];
            parameters.caption = "This is a test photo of a monkey that has been uploaded " +
                                 "by the Funtown C# SDK (http://funtownsdk.codeplex.com)" +
                                 "using the REST API";
            parameters.method = "funtown.photos.upload";
            parameters.uid = ConfigurationManager.AppSettings["UserId"];
            var mediaObject = new FuntownMediaObject
            {
                FileName = "monkey.jpg",
                ContentType = "image/jpeg",
            };
            mediaObject.SetValue(photo);
            parameters.source = mediaObject;
            dynamic result = app.Post(parameters);

            Assert.NotNull(result);
            Assert.NotEqual(result.aid, null);
        }
        public void Publish_Photo_To_Existing_Album()
        {
            #if DEBUG
            string photoPath = @"..\..\..\Funtown.Tests\bin\Debug\monkey.jpg";
            #else
            string photoPath = @"..\..\..\Funtown.Tests\bin\Release\monkey.jpg";
            #endif
            string albumId = ConfigurationManager.AppSettings["AlbumId"];
            byte[] photo = File.ReadAllBytes(photoPath);

            FuntownClient app = new FuntownClient();
            dynamic parameters = new ExpandoObject();
            parameters.access_token = ConfigurationManager.AppSettings["AccessToken"];
            parameters.message = "This is a test photo of a monkey that has been uploaded " +
                                 "by the Funtown C# SDK (http://funtownsdk.codeplex.com)" +
                                 "using the Graph API";
            var mediaObject = new FuntownMediaObject
            {
                FileName = "monkey.jpg",
                ContentType = "image/jpeg",
            };
            mediaObject.SetValue(photo);
            parameters.source = mediaObject;

            dynamic result = app.Post(String.Format("/{0}/photos", albumId), parameters);

            Assert.NotNull(result);
            Assert.NotEqual(null, result.id);
        }
        public void Publish_Global_News()
        {
            FuntownClient app = new FuntownClient();
            dynamic parameters = new ExpandoObject();
            parameters.method = "dashboard.addGlobalNews";

            var list = new List<object>();
            dynamic news1 = new ExpandoObject();
            news1.message = "This is a test news message. " + DateTime.UtcNow.Ticks.ToString();
            list.Add(news1);

            parameters.news = list;

            dynamic result = app.Post(parameters);

            long id;
            long.TryParse(result, out id);
            Assert.True(id > 0);
        }
        public void Publish_Video_To_Wall()
        {
            var videoPath = TestHelpers.GetPathRelativeToExecutable("do-beer-not-drugs.3gp");
            byte[] video = File.ReadAllBytes(videoPath);

            var mediaObject = new FuntownMediaObject
                                  {
                                      FileName = "do-beer-not-drugs.3gp",
                                      ContentType = "video/3gpp"
                                  };
            mediaObject.SetValue(video);

            dynamic parameters = new ExpandoObject();
            parameters.source = mediaObject;
            parameters.method = "video.upload";
            parameters.access_token = ConfigurationManager.AppSettings["AccessToken"];

            var fb = new FuntownClient();
            dynamic result = fb.Post(parameters);

            Assert.NotNull(result);
            Assert.NotEqual(null, result.vid);
        }
        public dynamic GraphVideoUploadTests(string accessToken, byte[] data, string contentType, string fileName)
        {
            return Test("graph video upload tests", () =>
                                                        {
                                                            var fb = new FuntownClient(accessToken);
                                                            var parameters = new Dictionary<string, object>();
                                                            parameters["source"] = new FuntownMediaObject
                                                                                       {
                                                                                           ContentType = contentType,
                                                                                           FileName = fileName
                                                                                       }.SetValue(data);
                                                            parameters["message"] = "graph video upload test";

                                                            return fb.Post("/me/videos", parameters);
                                                        });
        }
        public dynamic PostExpandoObjectTest(string accessToken)
        {
            return Test("post message with dictionary<string,object>",
                        () =>
                        {
                            var fb = new FuntownClient(accessToken);
                            dynamic parameter = new ExpandoObject();
                            parameter.message = "dynamic expando object test from fb c# sdk";

                            return fb.Post("/me/feed", parameter);
                        });
        }
 public dynamic PostDictionaryTest(string accessToken)
 {
     return Test("post message with dictionary<string,object>",
                 () =>
                 {
                     var fb = new FuntownClient(accessToken);
                     return fb.Post("/me/feed",
                                    new Dictionary
                                        <string, object>
                                            {
                                                {
                                                    "message",
                                                    "dictionary<string,object> test from fb c# sdk"
                                                    }
                                            });
                 });
 }
        public void LegacyRestApiVideoUploadTests(string accessToken, byte[] data, string contentType, string fileName)
        {
            Test("legacy rest api video upload tests",
                 () =>
                 {
                     var fb = new FuntownClient(accessToken);

                     var mediaObject = new FuntownMediaObject
                     {
                         ContentType = contentType,
                         FileName = fileName
                     }.SetValue(data);

                     var parameters = new Dictionary<string, object>();
                     parameters["source"] = mediaObject;
                     parameters["caption"] = "video upload using fb c# sdk";
                     parameters["method"] = "video.upload";

                     return fb.Post(parameters);
                 });
        }
        public void Wall_Post_Publish()
        {
            FuntownClient app = new FuntownClient();
            dynamic parameters = new ExpandoObject();
            parameters.access_token = ConfigurationManager.AppSettings["AccessToken"];
            parameters.message = "This is a test message that has been published by the Funtown C# SDK on Codeplex. " + DateTime.UtcNow.Ticks.ToString();
            parameters.attribution = "Funtown C# SDK";

            dynamic result = app.Post("/me/feed", parameters);

            Assert.NotEqual(null, result.id);
        }
        public void Wall_Post_Publish_And_Delete()
        {
            FuntownClient app = new FuntownClient();
            dynamic parameters = new ExpandoObject();
            parameters.access_token = ConfigurationManager.AppSettings["AccessToken"];
            parameters.message = "This is a test message that has been published by the Funtown C# SDK on Codeplex. " + DateTime.UtcNow.Ticks.ToString();

            dynamic result = app.Post("/me/feed", parameters);

            Assert.NotEqual(null, result.id);

            // Delete methods should return 'true'
            var isDeleted = app.Delete(result.id);

            Assert.True(isDeleted);
        }