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 dynamic DeleteTest(string accessToken, string path) { return Test("delete test", () => { var fb = new FuntownClient(accessToken); return fb.Delete(path); }); }
public ApiResultSerializationTest() { app = new FuntownClient(); //app.Session = new FuntownSession //{ // AccessToken = ConfigurationManager.AppSettings["AccessToken"], //}; }
public TypedObjectTests() { app = new FuntownClient(); //app.Session = new FuntownSession //{ // AccessToken = ConfigurationManager.AppSettings["AccessToken"], //}; }
public dynamic GetTestWithAccessToken(string accessToken) { return Test("get test with access token", () => { var fb = new FuntownClient(accessToken); return fb.Get("/me"); }); }
public void FqlSingleQueryTests(string accessToken) { Test("fql single query test", () => { var fb = new FuntownClient(accessToken); return fb.Query("SELECT uid,name FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1=me())"); }); }
public dynamic FqlMultiQueryTests(string accessToken) { return Test("fql multi query test", () => { var fb = new FuntownClient(accessToken); return fb.Query( "SELECT uid,name FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1=me())", "SELECT name FROM user WHERE uid=me()"); }); }
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); }
private void BatchRequestNullReferenceExceptionWhenOmitReponseOnSuccessIsTrue(string accessToken) { Test("(#5883) Batch Request NullReferenceException when omit_response_on_success = true", () => { var fb = new FuntownClient(accessToken); return fb.Batch( new FuntownBatchParameter("/me") { Data = new { omit_respone_on_success = true, name = "get-uid" } }, new FuntownBatchParameter("/", new { ids = "result=get-uid:$..id" })); }); }
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 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 void LegacyRestApiTests() { Test("legacy rest api tests", () => { var fb = new FuntownClient(); var parameters = new Dictionary<string, object>(); parameters["fields"] = new[] { "name" }; parameters["uids"] = new[] { 4 }; parameters["method"] = "users.getInfo"; return fb.Get(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 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 dynamic GetTestWithoutAccessToken() { return Test("get test without access token", () => { var fb = new FuntownClient(); return fb.Get("4"); }); }
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 FqlReadTests() { app = new FuntownClient(); app.AccessToken = ConfigurationManager.AppSettings["AccessToken"]; }
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); }