├── VERSION ├── Source ├── SharedKey.snk ├── logo32x32.png ├── logo75x75.png ├── logo500x500.png ├── .nuget │ ├── packages.config │ └── NuGet.Config ├── Facebook.IntegrationTests │ ├── packages.config │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── GraphInsiteTests.cs │ ├── Helpers │ │ └── TestHelpers.cs │ ├── User.cs │ ├── TypedObjectTests.cs │ └── RestReadTests.cs ├── Facebook.Tests │ ├── Properties │ │ ├── AppManifest.xml │ │ └── AssemblyInfo.cs │ ├── App.xaml │ ├── packages.config │ ├── app.config │ ├── DummyIntegrationTests.cs │ ├── FacebookUtils │ │ ├── MultiPartFormPrefixTests.cs │ │ ├── MultipPartNewLineTests.cs │ │ ├── UrlEncode │ │ │ ├── GivenAUrlPartWithWhiteSpacesThen.cs │ │ │ ├── GivenAStringWithPipleLineSymbolThen.cs │ │ │ └── GivenAUrlEncodedCodeThen.cs │ │ ├── UrlDecode │ │ │ ├── GivenAUrlPartWithPlusSignThen.cs │ │ │ ├── GivenAUrlWithPipeLineEncodedAsPercent7CThen.cs │ │ │ └── GivenAUrlEncodedFacebookAccessTokenThen.cs │ │ ├── ToJsonQueryString │ │ │ ├── WhenObjectDictionaryIsNotNullAndEmptyThen.cs │ │ │ ├── WhenStringDictionaryIsNotNullAndEmptyThen.cs │ │ │ ├── GivenADateTimeWithTimeZoneThen.cs │ │ │ ├── WhenObjectDictionaryContainsObjectAsListOfStringThen.cs │ │ │ ├── GivenAFQLQueryThen.cs │ │ │ ├── GivenAnObjectWithASecondLevelThen.cs │ │ │ ├── WhenObjectDictionaryHasValuesThen.cs │ │ │ └── WhenStringDictionaryHasValuesThen.cs │ │ ├── ToUnixTime │ │ │ └── GivenADateTimeObjectThen.cs │ │ ├── FromUnixTime │ │ │ ├── GivenAUnixTimeInDoubleThen.cs │ │ │ └── GivenAUnixTimeInStringThen.cs │ │ ├── IsUsingRestApi │ │ │ └── GivenDomainMapsAsNull │ │ │ │ ├── AndRequestUriIsApiUrlThen.cs │ │ │ │ ├── AndRequestUriIsApiReadThen.cs │ │ │ │ ├── AndRequestUriIsApiVideoThen.cs │ │ │ │ └── AndRequestUriIsGraphUrlThen.cs │ │ ├── FromIso8601FormattedDateTimeTests.cs │ │ ├── ParseUrlQueryString │ │ │ ├── GivenAQuerystringAsNullThen.cs │ │ │ ├── GivenAQuerystringWithCodeThen.cs │ │ │ ├── GivenAQuerystringAsStringEmptyThen.cs │ │ │ ├── GivenAQueryStringWithErrorThenDescriptionContainingPlusSignThen.cs │ │ │ ├── GivenAQuerystringAsWhitespaceThen.cs │ │ │ ├── GivenAQueryStringWithAcessTokenAndExpiresInThen.cs │ │ │ └── GivenAValidQuerystringThen.cs │ │ ├── ParseQueryParametersToDictionary │ │ │ ├── GivenAPathAsEmptyStringAndEmptyParametersThen.cs │ │ │ ├── GivenAPathWithoutQuerystringAndEmptyParametersThen.cs │ │ │ ├── GivenAPathWithQueryStringShouldUrlDecodeCorrectly.cs │ │ │ ├── GivenAPathStartingWithForwardSlashAndNoQueryStringAndEmptyParametersThen.cs │ │ │ ├── GivenAPathStartingWithForwardSlashWithQuerystringAndEmptyParametersThen.cs │ │ │ └── GivenAPathWith2QuerystringsAndEmptyParametersThen.cs │ │ ├── ConvertToString │ │ │ ├── GivenANumberOutOfHttpMethodRangeThen.cs │ │ │ ├── GivenAHttpMethodEnumThen.cs │ │ │ └── GivenANumberInEnumRangeThen.cs │ │ ├── DropQueryParametersTests.cs │ │ └── Merge │ │ │ ├── WhenBothInputsAreNullThen.cs │ │ │ ├── WhenBothInputsAreEmptyAndNotNullThen.cs │ │ │ ├── WhenFirstInputIsNullAndSecondIsEmptyAndNotNullThen.cs │ │ │ ├── WhenFirstInputIsEmptyAndNotNullAndSecondInputIsNullThen.cs │ │ │ └── WhenBothTheCombinationOfFirstInputAndSecondInputContainsUniqueKeysThen.cs │ ├── ExceptionFactory │ │ ├── GetRestException │ │ │ ├── GivenInputAsNullThen.cs │ │ │ ├── GivenAnEmptyDictionaryOfStringObjectThen.cs │ │ │ ├── GivenANonEmptyDictionaryOfStringObjectThatDoesNotContainErrorCodeKeyThen.cs │ │ │ ├── GivenNonNullInputNotOfTypeIDictionaryStringObjectThen.cs │ │ │ ├── GivenAnDictionaryStringObjectWithErrorCodeNotEqualTo190Or4WithMessageRequestLimitReachedThen.cs │ │ │ ├── GivenADictionaryOfStringObjectThatContainsErrorCodeOnlyThen.cs │ │ │ ├── GivenADictionaryOfStringObjectWithErrorCode4Then.cs │ │ │ ├── GivenADictionaryOfStringObjectWithErrorCode190Then.cs │ │ │ └── GivenADictionaryOfStringObjectWithErrorCodeAsApiEcTooManyCallsThen.cs │ │ └── GetGraphException │ │ │ └── Object │ │ │ ├── GivenInputAsNullThen.cs │ │ │ ├── GivenAnEmptyDictionaryOfStringObjectThen.cs │ │ │ ├── GivenANonEmptyDictionaryOfStringObjectThatDoesNotContainErrorKeyThen.cs │ │ │ └── GivenNonNullInputNotOfTypeIDictionaryStringObjectThen.cs │ ├── FacebookClient │ │ ├── GetApiUrl │ │ │ ├── GivenMethodIsVideoUploadThen.cs │ │ │ ├── GivenMethodsThanAreNotReadOnlyOrVideoUploadThen.cs │ │ │ ├── GivenMethodIsNotAllSmallLetterThen.cs │ │ │ └── Fakes │ │ │ │ └── FakeFacebookClient.cs │ │ └── ExtractMediaObject │ │ │ ├── GivenNullParametersThen.cs │ │ │ ├── GivenEmptyParametersThen.cs │ │ │ ├── GiveOneMediaObjectOnlyThen.cs │ │ │ ├── GivenOneMediaObjectThen.cs │ │ │ └── GivenMoreThanOneMediaObjectsOnlyThen.cs │ ├── FacebookClientTests │ │ └── SerializeJsonTests.cs │ └── HttpHelperTests.cs ├── packages │ └── repositories.config ├── Facebook │ ├── packages.config │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── HttpMethod.cs │ ├── HttpWebRequestCreatedEventArgs.cs │ ├── FacebookClient.Batch.Sync.cs │ ├── TaskExtensions.cs │ └── FacebookMediaObject.cs ├── CustomDictionary.xml ├── Settings.StyleCop ├── Facebook-WindowsStore.sln ├── Facebook-Universal-8.1.sln ├── CustomRules.ruleset ├── Facebook-SL5.sln ├── Facebook-WP8.sln ├── Facebook-WP8.1-SL.sln ├── Facebook-WP7.sln ├── Facebook-Net35.sln ├── Facebook-Net45.sln └── Facebook-Net40.sln ├── clean.cmd ├── Tools └── xunitcontrib-silverlight.0.2 │ ├── Silverlight3 │ ├── xunit-silverlight3.dll │ ├── xunit-silverlight3.pdb │ ├── xunit.extensions-silverlight3.dll │ ├── xunit.extensions-silverlight3.pdb │ ├── xunitcontrib.runner.silverlight.toolkit-sl3.dll │ └── xunitcontrib.runner.silverlight.toolkit-sl3.pdb │ ├── Silverlight4 │ ├── xunit-silverlight4.dll │ ├── xunit-silverlight4.pdb │ ├── xunit.extensions-silverlight4.dll │ ├── xunit.extensions-silverlight4.pdb │ ├── xunitcontrib.runner.silverlight.toolkit-sl4.dll │ └── xunitcontrib.runner.silverlight.toolkit-sl4.pdb │ ├── WindowsPhone7 │ ├── xunit-silverlight-wp7.dll │ ├── xunit-silverlight-wp7.pdb │ ├── xunit.extensions-silverlight-wp7.dll │ ├── xunit.extensions-silverlight-wp7.pdb │ ├── xunitcontrib.runner.silverlight.toolkit-wp7.dll │ └── xunitcontrib.runner.silverlight.toolkit-wp7.pdb │ ├── MicrosoftSilverlightTesting-04-2010-SL4 │ ├── Microsoft.Silverlight.Testing.dll │ ├── Microsoft.Silverlight.Testing.pdb │ ├── Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll │ └── Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.pdb │ ├── MicrosoftSilverlightTesting-05-2010-SL3 │ ├── Microsoft.Silverlight.Testing.dll │ ├── Microsoft.Silverlight.Testing.pdb │ ├── Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll │ └── Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.pdb │ └── EULA.txt ├── .gitignore ├── doc-config.json ├── .gitattributes ├── NOTICE.txt ├── README.md └── Build ├── readme.txt └── NuGet └── Facebook └── Facebook.nuspec /VERSION: -------------------------------------------------------------------------------- 1 | 6.0.10 2 | 7.0.9-beta 3 | -------------------------------------------------------------------------------- /Source/SharedKey.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephwoodward/facebook-csharp-sdk/master/Source/SharedKey.snk -------------------------------------------------------------------------------- /Source/logo32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephwoodward/facebook-csharp-sdk/master/Source/logo32x32.png -------------------------------------------------------------------------------- /Source/logo75x75.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephwoodward/facebook-csharp-sdk/master/Source/logo75x75.png -------------------------------------------------------------------------------- /Source/logo500x500.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephwoodward/facebook-csharp-sdk/master/Source/logo500x500.png -------------------------------------------------------------------------------- /Source/.nuget/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /Source/Facebook.IntegrationTests/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /clean.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | echo See http://csharpsdk.org/docs/build for information on how to build 4 | 5 | PUSHD "%~dp0" 6 | 7 | jake clean 8 | 9 | :END 10 | POPD 11 | -------------------------------------------------------------------------------- /Source/.nuget/NuGet.Config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Tools/xunitcontrib-silverlight.0.2/Silverlight3/xunit-silverlight3.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephwoodward/facebook-csharp-sdk/master/Tools/xunitcontrib-silverlight.0.2/Silverlight3/xunit-silverlight3.dll -------------------------------------------------------------------------------- /Tools/xunitcontrib-silverlight.0.2/Silverlight3/xunit-silverlight3.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephwoodward/facebook-csharp-sdk/master/Tools/xunitcontrib-silverlight.0.2/Silverlight3/xunit-silverlight3.pdb -------------------------------------------------------------------------------- /Tools/xunitcontrib-silverlight.0.2/Silverlight4/xunit-silverlight4.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephwoodward/facebook-csharp-sdk/master/Tools/xunitcontrib-silverlight.0.2/Silverlight4/xunit-silverlight4.dll -------------------------------------------------------------------------------- /Tools/xunitcontrib-silverlight.0.2/Silverlight4/xunit-silverlight4.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephwoodward/facebook-csharp-sdk/master/Tools/xunitcontrib-silverlight.0.2/Silverlight4/xunit-silverlight4.pdb -------------------------------------------------------------------------------- /Tools/xunitcontrib-silverlight.0.2/WindowsPhone7/xunit-silverlight-wp7.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephwoodward/facebook-csharp-sdk/master/Tools/xunitcontrib-silverlight.0.2/WindowsPhone7/xunit-silverlight-wp7.dll -------------------------------------------------------------------------------- /Tools/xunitcontrib-silverlight.0.2/WindowsPhone7/xunit-silverlight-wp7.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephwoodward/facebook-csharp-sdk/master/Tools/xunitcontrib-silverlight.0.2/WindowsPhone7/xunit-silverlight-wp7.pdb -------------------------------------------------------------------------------- /Tools/xunitcontrib-silverlight.0.2/Silverlight3/xunit.extensions-silverlight3.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephwoodward/facebook-csharp-sdk/master/Tools/xunitcontrib-silverlight.0.2/Silverlight3/xunit.extensions-silverlight3.dll -------------------------------------------------------------------------------- /Tools/xunitcontrib-silverlight.0.2/Silverlight3/xunit.extensions-silverlight3.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephwoodward/facebook-csharp-sdk/master/Tools/xunitcontrib-silverlight.0.2/Silverlight3/xunit.extensions-silverlight3.pdb -------------------------------------------------------------------------------- /Tools/xunitcontrib-silverlight.0.2/Silverlight4/xunit.extensions-silverlight4.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephwoodward/facebook-csharp-sdk/master/Tools/xunitcontrib-silverlight.0.2/Silverlight4/xunit.extensions-silverlight4.dll -------------------------------------------------------------------------------- /Tools/xunitcontrib-silverlight.0.2/Silverlight4/xunit.extensions-silverlight4.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephwoodward/facebook-csharp-sdk/master/Tools/xunitcontrib-silverlight.0.2/Silverlight4/xunit.extensions-silverlight4.pdb -------------------------------------------------------------------------------- /Tools/xunitcontrib-silverlight.0.2/WindowsPhone7/xunit.extensions-silverlight-wp7.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephwoodward/facebook-csharp-sdk/master/Tools/xunitcontrib-silverlight.0.2/WindowsPhone7/xunit.extensions-silverlight-wp7.dll -------------------------------------------------------------------------------- /Tools/xunitcontrib-silverlight.0.2/WindowsPhone7/xunit.extensions-silverlight-wp7.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephwoodward/facebook-csharp-sdk/master/Tools/xunitcontrib-silverlight.0.2/WindowsPhone7/xunit.extensions-silverlight-wp7.pdb -------------------------------------------------------------------------------- /Tools/xunitcontrib-silverlight.0.2/Silverlight3/xunitcontrib.runner.silverlight.toolkit-sl3.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephwoodward/facebook-csharp-sdk/master/Tools/xunitcontrib-silverlight.0.2/Silverlight3/xunitcontrib.runner.silverlight.toolkit-sl3.dll -------------------------------------------------------------------------------- /Tools/xunitcontrib-silverlight.0.2/Silverlight3/xunitcontrib.runner.silverlight.toolkit-sl3.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephwoodward/facebook-csharp-sdk/master/Tools/xunitcontrib-silverlight.0.2/Silverlight3/xunitcontrib.runner.silverlight.toolkit-sl3.pdb -------------------------------------------------------------------------------- /Tools/xunitcontrib-silverlight.0.2/Silverlight4/xunitcontrib.runner.silverlight.toolkit-sl4.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephwoodward/facebook-csharp-sdk/master/Tools/xunitcontrib-silverlight.0.2/Silverlight4/xunitcontrib.runner.silverlight.toolkit-sl4.dll -------------------------------------------------------------------------------- /Tools/xunitcontrib-silverlight.0.2/Silverlight4/xunitcontrib.runner.silverlight.toolkit-sl4.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephwoodward/facebook-csharp-sdk/master/Tools/xunitcontrib-silverlight.0.2/Silverlight4/xunitcontrib.runner.silverlight.toolkit-sl4.pdb -------------------------------------------------------------------------------- /Tools/xunitcontrib-silverlight.0.2/WindowsPhone7/xunitcontrib.runner.silverlight.toolkit-wp7.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephwoodward/facebook-csharp-sdk/master/Tools/xunitcontrib-silverlight.0.2/WindowsPhone7/xunitcontrib.runner.silverlight.toolkit-wp7.dll -------------------------------------------------------------------------------- /Tools/xunitcontrib-silverlight.0.2/WindowsPhone7/xunitcontrib.runner.silverlight.toolkit-wp7.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephwoodward/facebook-csharp-sdk/master/Tools/xunitcontrib-silverlight.0.2/WindowsPhone7/xunitcontrib.runner.silverlight.toolkit-wp7.pdb -------------------------------------------------------------------------------- /Source/Facebook.Tests/Properties/AppManifest.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Tools/xunitcontrib-silverlight.0.2/MicrosoftSilverlightTesting-04-2010-SL4/Microsoft.Silverlight.Testing.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephwoodward/facebook-csharp-sdk/master/Tools/xunitcontrib-silverlight.0.2/MicrosoftSilverlightTesting-04-2010-SL4/Microsoft.Silverlight.Testing.dll -------------------------------------------------------------------------------- /Tools/xunitcontrib-silverlight.0.2/MicrosoftSilverlightTesting-04-2010-SL4/Microsoft.Silverlight.Testing.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephwoodward/facebook-csharp-sdk/master/Tools/xunitcontrib-silverlight.0.2/MicrosoftSilverlightTesting-04-2010-SL4/Microsoft.Silverlight.Testing.pdb -------------------------------------------------------------------------------- /Tools/xunitcontrib-silverlight.0.2/MicrosoftSilverlightTesting-05-2010-SL3/Microsoft.Silverlight.Testing.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephwoodward/facebook-csharp-sdk/master/Tools/xunitcontrib-silverlight.0.2/MicrosoftSilverlightTesting-05-2010-SL3/Microsoft.Silverlight.Testing.dll -------------------------------------------------------------------------------- /Tools/xunitcontrib-silverlight.0.2/MicrosoftSilverlightTesting-05-2010-SL3/Microsoft.Silverlight.Testing.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephwoodward/facebook-csharp-sdk/master/Tools/xunitcontrib-silverlight.0.2/MicrosoftSilverlightTesting-05-2010-SL3/Microsoft.Silverlight.Testing.pdb -------------------------------------------------------------------------------- /Source/packages/repositories.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Source/Facebook/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Tools/xunitcontrib-silverlight.0.2/MicrosoftSilverlightTesting-04-2010-SL4/Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephwoodward/facebook-csharp-sdk/master/Tools/xunitcontrib-silverlight.0.2/MicrosoftSilverlightTesting-04-2010-SL4/Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll -------------------------------------------------------------------------------- /Tools/xunitcontrib-silverlight.0.2/MicrosoftSilverlightTesting-04-2010-SL4/Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephwoodward/facebook-csharp-sdk/master/Tools/xunitcontrib-silverlight.0.2/MicrosoftSilverlightTesting-04-2010-SL4/Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.pdb -------------------------------------------------------------------------------- /Tools/xunitcontrib-silverlight.0.2/MicrosoftSilverlightTesting-05-2010-SL3/Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephwoodward/facebook-csharp-sdk/master/Tools/xunitcontrib-silverlight.0.2/MicrosoftSilverlightTesting-05-2010-SL3/Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll -------------------------------------------------------------------------------- /Tools/xunitcontrib-silverlight.0.2/MicrosoftSilverlightTesting-05-2010-SL3/Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephwoodward/facebook-csharp-sdk/master/Tools/xunitcontrib-silverlight.0.2/MicrosoftSilverlightTesting-05-2010-SL3/Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.pdb -------------------------------------------------------------------------------- /Source/Facebook.Tests/App.xaml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Source/Facebook.Tests/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Source/Facebook.Tests/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Source/Facebook/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | // Do not modify this file manually, use jakefile instead. 4 | [assembly: AssemblyTitle("Facebook")] 5 | [assembly: AssemblyDescription("Facebook C# SDK")] 6 | [assembly: AssemblyCompany("The Outercurve Foundation")] 7 | [assembly: AssemblyProduct("Facebook C# SDK")] 8 | [assembly: AssemblyCopyright("Copyright (c) 2011, The Outercurve Foundation.")] 9 | [assembly: ComVisible(false)] 10 | [assembly: AssemblyVersion("6.0.10")] 11 | [assembly: AssemblyFileVersion("7.0.9-beta")] 12 | -------------------------------------------------------------------------------- /Source/CustomDictionary.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | facebook 6 | IFrame 7 | Json 8 | Auth 9 | Fql 10 | Mvc 11 | xfbml 12 | fbml 13 | plugin 14 | facepile 15 | unix 16 | 17 | 18 | 19 | 20 | Fql 21 | 22 | 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Visual Studio Ignores 2 | [Bb]in/ 3 | obj/ 4 | TestResults/ 5 | 6 | *.sln.cache 7 | *.docstates 8 | *.suo 9 | *.user 10 | *.xap 11 | !*StatLight.Client.For.*.xap 12 | 13 | *.ncb 14 | 15 | # Visual Studio Extensions Ignores 16 | .vs10x 17 | *.vs10x 18 | 19 | # Resharper Ignores 20 | _ReSharper.*/ 21 | *.resharper.user 22 | 23 | # StyleCop cache ignores 24 | *StyleCop.Cache 25 | 26 | # Ignore TypeMock TestLint Cache 27 | lint.db 28 | 29 | # vim Ignore 30 | *.swp 31 | 32 | # kdiff3 Ignore 33 | *.orig 34 | 35 | # LATEX Ignores 36 | *.tex.undo 37 | 38 | # Misc Ignores 39 | Thumbs.db 40 | !libs/*/[Bb]in/ 41 | 42 | #FacebookSDK ignores 43 | Working/ 44 | Dist/ 45 | packages/ 46 | NuGet.exe 47 | doc_output/ 48 | -------------------------------------------------------------------------------- /Source/Settings.StyleCop: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | False 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | False 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /doc-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "projects" : [ 3 | { 4 | "path": ".\\Source\\Facebook\\Facebook-Net35.csproj", 5 | "id": ".NET Framework 3.5" 6 | }, 7 | { 8 | "path": ".\\Source\\Facebook\\Facebook-Net40.csproj", 9 | "id": ".NET Framework 4.0" 10 | }, 11 | { 12 | "path": ".\\Source\\Facebook\\Facebook-Net45.csproj", 13 | "id": ".NET Framework 4.5" 14 | }, 15 | { 16 | "path": ".\\Source\\Facebook\\Facebook-SL5.csproj", 17 | "id": "Silverlight 5" 18 | }, 19 | { 20 | "path": ".\\Source\\Facebook\\Facebook-WindowsStore.csproj", 21 | "id": ".NET for Windows Store apps" 22 | }, 23 | { 24 | "path": ".\\Source\\Facebook\\Facebook-WP7.csproj", 25 | "id": "Windows Phone 7" 26 | }, 27 | { 28 | "path": ".\\Source\\Facebook\\Facebook-WP8.csproj", 29 | "id": "Windows Phone 8" 30 | } 31 | ], 32 | "filteredNamespaces": [ 33 | "Facebook", 34 | ] 35 | } -------------------------------------------------------------------------------- /Source/Facebook-WindowsStore.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2012 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook-WindowsStore", "Facebook\Facebook-WindowsStore.csproj", "{4D5581CB-93C2-4925-A3A5-E17E5DEF09D9}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Any CPU = Debug|Any CPU 9 | Release|Any CPU = Release|Any CPU 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {4D5581CB-93C2-4925-A3A5-E17E5DEF09D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 13 | {4D5581CB-93C2-4925-A3A5-E17E5DEF09D9}.Debug|Any CPU.Build.0 = Debug|Any CPU 14 | {4D5581CB-93C2-4925-A3A5-E17E5DEF09D9}.Release|Any CPU.ActiveCfg = Release|Any CPU 15 | {4D5581CB-93C2-4925-A3A5-E17E5DEF09D9}.Release|Any CPU.Build.0 = Release|Any CPU 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /Source/Facebook-Universal-8.1.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.30324.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook-Universal-8.1", "Facebook\Facebook-Universal-8.1.csproj", "{08B0A0F5-EF42-4A7E-954A-8F7648A322DE}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {08B0A0F5-EF42-4A7E-954A-8F7648A322DE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {08B0A0F5-EF42-4A7E-954A-8F7648A322DE}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {08B0A0F5-EF42-4A7E-954A-8F7648A322DE}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {08B0A0F5-EF42-4A7E-954A-8F7648A322DE}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.doc diff=astextplain 2 | *.DOC diff=astextplain 3 | *.docx diff=astextplain 4 | *.DOCX diff=astextplain 5 | *.dot diff=astextplain 6 | *.DOT diff=astextplain 7 | *.pdf diff=astextplain 8 | *.PDF diff=astextplain 9 | *.rtf diff=astextplain 10 | *.RTF diff=astextplain 11 | 12 | *.jpg binary 13 | *.png binary 14 | *.gif binary 15 | 16 | *.cs -text diff=csharp 17 | *.vb -text 18 | *.c -text 19 | *.cpp -text 20 | *.cxx -text 21 | *.h -text 22 | *.hxx -text 23 | *.py -text 24 | *.rb -text 25 | *.java -text 26 | *.html -text 27 | *.htm -text 28 | *.css -text 29 | *.scss -text 30 | *.sass -text 31 | *.less -text 32 | *.js -text 33 | *.lisp -text 34 | *.clj -text 35 | *.sql -text 36 | *.php -text 37 | *.lua -text 38 | *.m -text 39 | *.asm -text 40 | *.erl -text 41 | *.fs -text 42 | *.fsx -text 43 | *.hs -text 44 | 45 | *.csproj -text merge=union 46 | *.vbproj -text merge=union 47 | *.fsproj -text merge=union 48 | *.dbproj -text merge=union 49 | *.sln -text eol=crlf merge=union 50 | 51 | .gitattributes -text 52 | *.cmd -text 53 | *.config -text 54 | *.xml -text 55 | Settings.StyleCop -text 56 | VERSION -text -------------------------------------------------------------------------------- /Source/CustomRules.ruleset: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Source/Facebook.IntegrationTests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | using System.Reflection; 21 | 22 | [assembly: AssemblyTitle("Facebook.IntegrationTests")] 23 | -------------------------------------------------------------------------------- /Source/Facebook.IntegrationTests/GraphInsiteTests.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.Graph { 21 | 22 | public class GraphInsiteTests { 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Source/Facebook.Tests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | using System.Reflection; 21 | using System.Runtime.CompilerServices; 22 | 23 | [assembly: AssemblyTitle("Facebook.Tests")] -------------------------------------------------------------------------------- /Source/Facebook-SL5.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook-SL5", "Facebook\Facebook-SL5.csproj", "{857E540C-0092-4590-A279-F98A6B77AC0A}" 5 | EndProject 6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{8AAF74FA-9F71-42CA-8216-817F15EDE6E1}" 7 | ProjectSection(SolutionItems) = preProject 8 | .nuget\NuGet.exe = .nuget\NuGet.exe 9 | .nuget\NuGet.targets = .nuget\NuGet.targets 10 | EndProjectSection 11 | EndProject 12 | Global 13 | GlobalSection(TestCaseManagementSettings) = postSolution 14 | CategoryFile = Facebook.vsmdi 15 | EndGlobalSection 16 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 17 | Debug|Any CPU = Debug|Any CPU 18 | Release|Any CPU = Release|Any CPU 19 | EndGlobalSection 20 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 21 | {857E540C-0092-4590-A279-F98A6B77AC0A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 22 | {857E540C-0092-4590-A279-F98A6B77AC0A}.Debug|Any CPU.Build.0 = Debug|Any CPU 23 | {857E540C-0092-4590-A279-F98A6B77AC0A}.Release|Any CPU.ActiveCfg = Release|Any CPU 24 | {857E540C-0092-4590-A279-F98A6B77AC0A}.Release|Any CPU.Build.0 = Release|Any CPU 25 | EndGlobalSection 26 | GlobalSection(SolutionProperties) = preSolution 27 | HideSolutionNode = FALSE 28 | EndGlobalSection 29 | EndGlobal 30 | -------------------------------------------------------------------------------- /Source/Facebook.Tests/DummyIntegrationTests.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebookx.Tests 21 | { 22 | using Xunit; 23 | using global::Facebook; 24 | using System; 25 | 26 | public class DummyIntegrationTests 27 | { 28 | [Fact] 29 | public void Test() 30 | { 31 | 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /Source/Facebook-WP8.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2012 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook-WP8", "Facebook\Facebook-WP8.csproj", "{857E540C-0092-4590-A279-F98A6B77AC0A}" 5 | EndProject 6 | Global 7 | GlobalSection(TestCaseManagementSettings) = postSolution 8 | CategoryFile = Facebook.vsmdi 9 | EndGlobalSection 10 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 11 | Debug|Any CPU = Debug|Any CPU 12 | Debug|x86 = Debug|x86 13 | Release|Any CPU = Release|Any CPU 14 | Release|x86 = Release|x86 15 | EndGlobalSection 16 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 17 | {857E540C-0092-4590-A279-F98A6B77AC0A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 18 | {857E540C-0092-4590-A279-F98A6B77AC0A}.Debug|Any CPU.Build.0 = Debug|Any CPU 19 | {857E540C-0092-4590-A279-F98A6B77AC0A}.Debug|x86.ActiveCfg = Debug|x86 20 | {857E540C-0092-4590-A279-F98A6B77AC0A}.Debug|x86.Build.0 = Debug|x86 21 | {857E540C-0092-4590-A279-F98A6B77AC0A}.Release|Any CPU.ActiveCfg = Release|Any CPU 22 | {857E540C-0092-4590-A279-F98A6B77AC0A}.Release|Any CPU.Build.0 = Release|Any CPU 23 | {857E540C-0092-4590-A279-F98A6B77AC0A}.Release|x86.ActiveCfg = Release|x86 24 | {857E540C-0092-4590-A279-F98A6B77AC0A}.Release|x86.Build.0 = Release|x86 25 | EndGlobalSection 26 | GlobalSection(SolutionProperties) = preSolution 27 | HideSolutionNode = FALSE 28 | EndGlobalSection 29 | EndGlobal 30 | -------------------------------------------------------------------------------- /Source/Facebook.Tests/FacebookUtils/MultiPartFormPrefixTests.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.FacebookUtils 21 | { 22 | using Facebook; 23 | using Xunit; 24 | 25 | public class MultiPartFormPrefixTests 26 | { 27 | [Fact] 28 | public void EqualsDoubleDash() 29 | { 30 | var result = FacebookUtils.MultiPartFormPrefix; 31 | 32 | Assert.Equal("--", result); 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /Source/Facebook.Tests/FacebookUtils/MultipPartNewLineTests.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.FacebookUtils 21 | { 22 | using Facebook; 23 | using Xunit; 24 | 25 | public class MultipPartNewLineTests 26 | { 27 | [Fact] 28 | public void EqualsSlashRSlashN() 29 | { 30 | var result = FacebookUtils.MultiPartNewLine; 31 | 32 | Assert.Equal("\r\n", result); 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /NOTICE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011, The Outercurve Foundation. 2 | This software is released under the Apache License 2.0 (the "License"); 3 | you may not use the software except in compliance with the License. You 4 | can find a copy of the License in the file LICENSE.TXT accompanying this 5 | file. 6 | 7 | Additional Libraries: 8 | This software includes or is derivative of works distributed under the 9 | licenses listed below. The full text for most of the licenses listed below 10 | can be found in the LICENSE.txt file accompanying each work. The original 11 | copyright notices have been preserved within the respective files and or 12 | packages. Please refer to the specific files and/or packages for more 13 | detailed information about the authors, copyright notices, and licenses. 14 | 15 | 16 | njake 17 | ----------------- 18 | Website: https://github.com/prabirshrestha/njake 19 | Copyright: N/A 20 | License: Apache 2.0 License 21 | 22 | 23 | xUnit.net 24 | ----------------- 25 | Website: http://xunit.codeplex.com 26 | Copyright: N/A 27 | License: Microsoft Public License (Ms-PL) 28 | 29 | 30 | xUnit.net Contrib 31 | ----------------- 32 | Website: http://xunitcontrib.codeplex.com 33 | Copyright: N/A 34 | License: Microsoft Public License (Ms-PL) 35 | 36 | 37 | SimpleJson 38 | ----------------- 39 | Website: https://github.com/facebook-csharp-sdk/simple-json 40 | Copyright: N/A 41 | License: MIT License 42 | 43 | 44 | Additional Notices: 45 | The software was originally conceived and created by Nathan Totten, 46 | Prabir Shersha, and Jim Zimmerman. 47 | 48 | Other contributors to the project include: 49 | N/A -------------------------------------------------------------------------------- /Source/Facebook.Tests/ExceptionFactory/GetRestException/GivenInputAsNullThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.ExceptionFactory.GetRestException 21 | { 22 | using Facebook; 23 | using Xunit; 24 | 25 | public class GivenInputAsNullThen 26 | { 27 | [Fact] 28 | public void ResultIsNull() 29 | { 30 | object input = null; 31 | 32 | var result = ExceptionFactory.GetRestException(input); 33 | 34 | Assert.Null(result); 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /Source/Facebook.IntegrationTests/Helpers/TestHelpers.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook 21 | { 22 | using System; 23 | using System.IO; 24 | using System.Reflection; 25 | 26 | public class TestHelpers 27 | { 28 | public static string GetPathRelativeToExecutable(string fileName) 29 | { 30 | string executable = new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath; 31 | return Path.GetFullPath(Path.Combine(Path.GetDirectoryName(executable), fileName)); 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /Source/Facebook.Tests/ExceptionFactory/GetGraphException/Object/GivenInputAsNullThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.ExceptionFactory.GetGraphException.Object 21 | { 22 | using Facebook; 23 | using Xunit; 24 | 25 | public class GivenInputAsNullThen 26 | { 27 | [Fact] 28 | public void ResultIsNull() 29 | { 30 | object input = null; 31 | 32 | var result = ExceptionFactory.GetGraphException(input); 33 | 34 | Assert.Null(result); 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /Source/Facebook/HttpMethod.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook 21 | { 22 | /// 23 | /// Represents an HTTP request type. 24 | /// 25 | public enum HttpMethod 26 | { 27 | /// 28 | /// A GET Request 29 | /// 30 | Get, 31 | 32 | /// 33 | /// A POST Request 34 | /// 35 | Post, 36 | 37 | /// 38 | /// A DELETE Request 39 | /// 40 | Delete, 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Source/Facebook.Tests/FacebookUtils/UrlEncode/GivenAUrlPartWithWhiteSpacesThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.FacebookUtils.UrlEncode 21 | { 22 | using Facebook; 23 | using Xunit; 24 | 25 | public class GivenAUrlPartWithWhiteSpacesThen 26 | { 27 | [Fact] 28 | public void WhiteSpacesShouldBeConvertedToPlusSign() 29 | { 30 | var urlPart = "hello world"; 31 | 32 | var result = FluentHttp.HttpHelper.UrlEncode(urlPart); 33 | 34 | Assert.Equal("hello%20world", result); 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /Source/Facebook.Tests/FacebookUtils/UrlDecode/GivenAUrlPartWithPlusSignThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.FacebookUtils.UrlDecode 21 | { 22 | using Facebook; 23 | using Xunit; 24 | 25 | public class GivenAUrlPartWithPlusSignThen 26 | { 27 | [Fact] 28 | public void PlusSignShouldBeConvertedToWhitespace() 29 | { 30 | var urlPart = "The+user+denied+your+request."; 31 | 32 | var result = FluentHttp.HttpHelper.UrlDecode(urlPart); 33 | 34 | Assert.Equal("The user denied your request.", result); 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /Source/Facebook.Tests/ExceptionFactory/GetRestException/GivenAnEmptyDictionaryOfStringObjectThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.ExceptionFactory.GetRestException 21 | { 22 | using System.Collections.Generic; 23 | using Xunit; 24 | 25 | public class GivenAnEmptyDictionaryOfStringObjectThen 26 | { 27 | [Fact] 28 | public void ResultIsNull() 29 | { 30 | var dict = new Dictionary(); 31 | 32 | var result = Facebook.ExceptionFactory.GetRestException(dict); 33 | 34 | Assert.Null(result); 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /Source/Facebook.Tests/ExceptionFactory/GetGraphException/Object/GivenAnEmptyDictionaryOfStringObjectThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.ExceptionFactory.GetGraphException.Object 21 | { 22 | using System.Collections.Generic; 23 | using Xunit; 24 | 25 | public class GivenAnEmptyDictionaryOfStringObjectThen 26 | { 27 | [Fact] 28 | public void ResultIsNull() 29 | { 30 | var dict = new Dictionary(); 31 | 32 | var result = Facebook.ExceptionFactory.GetRestException(dict); 33 | 34 | Assert.Null(result); 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /Source/Facebook.Tests/FacebookClient/GetApiUrl/GivenMethodIsVideoUploadThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.FacebookClient.GetApiUrl 21 | { 22 | using Tests.FacebookClient.GetApiUrl.Fakes; 23 | using Xunit; 24 | 25 | public class GivenMethodIsVideoUploadThen 26 | { 27 | [Fact] 28 | public void TheUriShouldStartWithApiVideoFacebookDomain() 29 | { 30 | var fb = new FakeFacebookClient(); 31 | 32 | var uri = fb.GetApiUrl("video.upload"); 33 | 34 | Assert.Equal("https://api-video.facebook.com/restserver.php", uri.AbsoluteUri); 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /Source/Facebook.Tests/FacebookUtils/ToJsonQueryString/WhenObjectDictionaryIsNotNullAndEmptyThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.FacebookUtils.ToJsonQueryString 21 | { 22 | using System.Collections.Generic; 23 | using Facebook; 24 | using Xunit; 25 | 26 | public class WhenObjectDictionaryIsNotNullAndEmptyThen 27 | { 28 | [Fact] 29 | public void ResultShouldBeEmptyString() 30 | { 31 | var dict = new Dictionary(); 32 | 33 | var result = FacebookUtils.ToJsonQueryString(dict); 34 | 35 | Assert.Equal(string.Empty, result); 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /Source/Facebook.Tests/FacebookUtils/ToJsonQueryString/WhenStringDictionaryIsNotNullAndEmptyThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.FacebookUtils.ToJsonQueryString 21 | { 22 | using System.Collections.Generic; 23 | using Facebook; 24 | using Xunit; 25 | 26 | public class WhenStringDictionaryIsNotNullAndEmptyThen 27 | { 28 | [Fact] 29 | public void ResultShouldBeEmptyString() 30 | { 31 | var dict = new Dictionary(); 32 | 33 | var result = FacebookUtils.ToJsonQueryString(dict); 34 | 35 | Assert.Equal(string.Empty, result); 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /Source/Facebook.Tests/FacebookUtils/ToUnixTime/GivenADateTimeObjectThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.FacebookUtils.ToUnixTime 21 | { 22 | using System; 23 | using Facebook; 24 | using Xunit; 25 | 26 | public class GivenADateTimeObjectThen 27 | { 28 | [Fact] 29 | public void ReturnsUnixTimeEquivalent() 30 | { 31 | DateTimeOffset dateTime = new DateTimeOffset(2010, 9, 16, 0, 0, 0, TimeSpan.FromHours(-7)); 32 | var expected = 1284620400; 33 | 34 | var actual = DateTimeConvertor.ToUnixTime(dateTime); 35 | 36 | Assert.Equal(expected, actual); 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /Source/Facebook.Tests/FacebookUtils/UrlEncode/GivenAStringWithPipleLineSymbolThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.FacebookUtils.UrlEncode 21 | { 22 | using Facebook; 23 | using Xunit; 24 | using Xunit.Extensions; 25 | 26 | public class GivenAStringWithPipleLineSymbolThen 27 | { 28 | [InlineData("%7C", "|")] 29 | [InlineData("3702%7C2", "3702|2")] 30 | [Theory] 31 | public void ItShouldEncodePipleAsPercent7C(string expectedUrl, string strToEncode) 32 | { 33 | var result = FluentHttp.HttpHelper.UrlEncode(strToEncode); 34 | 35 | Assert.Equal(expectedUrl, result); 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /Source/Facebook.Tests/FacebookUtils/FromUnixTime/GivenAUnixTimeInDoubleThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.FacebookUtils.FromUnixTime 21 | { 22 | using System; 23 | using Facebook; 24 | using Xunit; 25 | 26 | public class GivenAUnixTimeInDoubleThen 27 | { 28 | [Fact] 29 | public void ReturnsDateTimeEquivalent() 30 | { 31 | var unixTimeinDouble = 1284620400; 32 | var expected = new DateTimeOffset(2010, 9, 16, 0, 0, 0, TimeSpan.FromHours(-7)); 33 | 34 | var actual = DateTimeConvertor.FromUnixTime(unixTimeinDouble); 35 | 36 | Assert.Equal(expected, actual); 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /Source/Facebook.Tests/FacebookUtils/FromUnixTime/GivenAUnixTimeInStringThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.FacebookUtils.FromUnixTime 21 | { 22 | using System; 23 | using Facebook; 24 | using Xunit; 25 | 26 | public class GivenAUnixTimeInStringThen 27 | { 28 | [Fact] 29 | public void ReturnsDateTimeEquivalent() 30 | { 31 | var unixTimeInString = "1284620400"; 32 | var expected = new DateTimeOffset(2010, 9, 16, 0, 0, 0, TimeSpan.FromHours(-7)); 33 | 34 | var actual = DateTimeConvertor.FromUnixTime(unixTimeInString); 35 | 36 | Assert.Equal(expected, actual); 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /Source/Facebook.Tests/FacebookUtils/IsUsingRestApi/GivenDomainMapsAsNull/AndRequestUriIsApiUrlThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.FacebookUtils.IsUsingRestApi.GivenDomainMapsAsNull 21 | { 22 | using System; 23 | using Facebook; 24 | using Xunit; 25 | using Xunit.Extensions; 26 | 27 | public class AndRequestUriIsApiUrlThen 28 | { 29 | [Theory] 30 | [InlineData("https://api.facebook.com")] 31 | public void ResultIsTrue(string url) 32 | { 33 | var uri = new Uri(url); 34 | 35 | var result = FacebookUtils.IsUsingRestApi(null, uri); 36 | 37 | Assert.True(result); 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /Source/Facebook.Tests/FacebookUtils/UrlDecode/GivenAUrlWithPipeLineEncodedAsPercent7CThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.FacebookUtils.UrlDecode 21 | { 22 | using Facebook; 23 | using Xunit; 24 | using Xunit.Extensions; 25 | 26 | public class GivenAUrlWithPipeLineEncodedAsPercent7CThen 27 | { 28 | [InlineData("%7C", "|")] 29 | [InlineData("3702%7C2", "3702|2")] 30 | [Theory] 31 | public void ItShouldBeConvertedToPipeLineSymbol(string encodedUrl, string expected) 32 | { 33 | var result = FluentHttp.HttpHelper.UrlDecode(encodedUrl); 34 | 35 | Assert.Equal(expected, result); 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /Source/Facebook.Tests/FacebookUtils/IsUsingRestApi/GivenDomainMapsAsNull/AndRequestUriIsApiReadThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.FacebookUtils.IsUsingRestApi.GivenDomainMapsAsNull 21 | { 22 | using System; 23 | using Facebook; 24 | using Xunit; 25 | using Xunit.Extensions; 26 | 27 | public class AndRequestUriIsApiReadThen 28 | { 29 | [Theory] 30 | [InlineData("https://api-read.facebook.com")] 31 | public void ResultIsTrue(string url) 32 | { 33 | var uri = new Uri(url); 34 | 35 | var result = FacebookUtils.IsUsingRestApi(null, uri); 36 | 37 | Assert.True(result); 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /Source/Facebook.Tests/FacebookUtils/IsUsingRestApi/GivenDomainMapsAsNull/AndRequestUriIsApiVideoThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.FacebookUtils.IsUsingRestApi.GivenDomainMapsAsNull 21 | { 22 | using System; 23 | using Facebook; 24 | using Xunit; 25 | using Xunit.Extensions; 26 | 27 | public class AndRequestUriIsApiVideoThen 28 | { 29 | [Theory] 30 | [InlineData("https://api-video.facebook.com")] 31 | public void ResultIsTrue(string url) 32 | { 33 | var uri = new Uri(url); 34 | 35 | var result = FacebookUtils.IsUsingRestApi(null, uri); 36 | 37 | Assert.True(result); 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /Source/Facebook.IntegrationTests/User.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | using System; 21 | using System.Collections.Generic; 22 | using System.Linq; 23 | using System.Text; 24 | using System.Runtime.Serialization; 25 | 26 | namespace Facebook.Graph 27 | { 28 | [DataContract] 29 | public class User 30 | { 31 | 32 | [DataMember(Name = "id")] 33 | public long Id { get; set; } 34 | 35 | [DataMember(Name = "first_name")] 36 | public string FirstName { get; set; } 37 | 38 | [DataMember(Name = "last_name")] 39 | public string LastName { get; set; } 40 | 41 | [DataMember(Name = "email")] 42 | public string Email { get; set; } 43 | 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Source/Facebook.Tests/FacebookClientTests/SerializeJsonTests.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.FacebookClient 21 | { 22 | using System.Collections.Generic; 23 | using Facebook; 24 | using Xunit; 25 | 26 | public class SerializeJsonTests 27 | { 28 | [Fact] 29 | public void SerializeBigNumbersCorrectly() 30 | { 31 | var parameters = new Dictionary(); 32 | parameters["object_id"] = 10150098461530576; 33 | 34 | var fb = new FacebookClient(); 35 | string json = fb.SerializeJson(parameters); 36 | 37 | Assert.Equal("{\"object_id\":10150098461530576}", json); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Source/Facebook-WP8.1-SL.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.30324.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook-WP8.1-SL", "Facebook\Facebook-WP8.1-SL.csproj", "{857E540C-0092-4590-A279-F98A6B77ACAB}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Debug|ARM = Debug|ARM 12 | Debug|x86 = Debug|x86 13 | Release|Any CPU = Release|Any CPU 14 | Release|ARM = Release|ARM 15 | Release|x86 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 18 | {857E540C-0092-4590-A279-F98A6B77ACAB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 19 | {857E540C-0092-4590-A279-F98A6B77ACAB}.Debug|Any CPU.Build.0 = Debug|Any CPU 20 | {857E540C-0092-4590-A279-F98A6B77ACAB}.Debug|ARM.ActiveCfg = Debug|ARM 21 | {857E540C-0092-4590-A279-F98A6B77ACAB}.Debug|ARM.Build.0 = Debug|ARM 22 | {857E540C-0092-4590-A279-F98A6B77ACAB}.Debug|x86.ActiveCfg = Debug|x86 23 | {857E540C-0092-4590-A279-F98A6B77ACAB}.Debug|x86.Build.0 = Debug|x86 24 | {857E540C-0092-4590-A279-F98A6B77ACAB}.Release|Any CPU.ActiveCfg = Release|Any CPU 25 | {857E540C-0092-4590-A279-F98A6B77ACAB}.Release|Any CPU.Build.0 = Release|Any CPU 26 | {857E540C-0092-4590-A279-F98A6B77ACAB}.Release|ARM.ActiveCfg = Release|ARM 27 | {857E540C-0092-4590-A279-F98A6B77ACAB}.Release|ARM.Build.0 = Release|ARM 28 | {857E540C-0092-4590-A279-F98A6B77ACAB}.Release|x86.ActiveCfg = Release|x86 29 | {857E540C-0092-4590-A279-F98A6B77ACAB}.Release|x86.Build.0 = Release|x86 30 | EndGlobalSection 31 | GlobalSection(SolutionProperties) = preSolution 32 | HideSolutionNode = FALSE 33 | EndGlobalSection 34 | EndGlobal 35 | -------------------------------------------------------------------------------- /Source/Facebook.Tests/FacebookUtils/FromIso8601FormattedDateTimeTests.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.FacebookUtils 21 | { 22 | using System; 23 | using Xunit; 24 | 25 | public class FromIso8601FormattedDateTimeTests 26 | { 27 | [Fact] 28 | public void GivenNullThrowsArgumentNullException() 29 | { 30 | Assert.Throws(() => DateTimeConvertor.FromIso8601FormattedDateTime(null)); 31 | } 32 | 33 | [Fact] 34 | public void GivenEmptyThrowsArgumnetNullException() 35 | { 36 | Assert.Throws(() => DateTimeConvertor.FromIso8601FormattedDateTime(string.Empty)); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Source/Facebook.Tests/FacebookUtils/ParseUrlQueryString/GivenAQuerystringAsNullThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.FacebookUtils.ParseUrlQueryString 21 | { 22 | using Facebook; 23 | using Xunit; 24 | 25 | public class GivenAQuerystringAsNullThen 26 | { 27 | [Fact] 28 | public void TheResultShouldNotBeNull() 29 | { 30 | var result = FacebookUtils.ParseUrlQueryString(null); 31 | 32 | Assert.NotNull(result); 33 | } 34 | 35 | [Fact] 36 | public void TheCountOfResultShouldBe0() 37 | { 38 | var result = FacebookUtils.ParseUrlQueryString(null); 39 | 40 | Assert.Equal(0, result.Count); 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /Source/Facebook.Tests/FacebookClient/GetApiUrl/GivenMethodsThanAreNotReadOnlyOrVideoUploadThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.FacebookClient.GetApiUrl 21 | { 22 | using Tests.FacebookClient.GetApiUrl.Fakes; 23 | using Xunit; 24 | using Xunit.Extensions; 25 | 26 | public class GivenMethodsThanAreNotReadOnlyOrVideoUploadThen 27 | { 28 | [InlineData("admin.banUsers")] 29 | [Theory] 30 | public void TheUriShouldStartWithApiFacebookDomain(string method) 31 | { 32 | var fb = new FakeFacebookClient(); 33 | 34 | var uri = fb.GetApiUrl(method); 35 | 36 | Assert.Equal("https://api.facebook.com/restserver.php", uri.AbsoluteUri); 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /Source/Facebook.Tests/FacebookUtils/ParseUrlQueryString/GivenAQuerystringWithCodeThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.FacebookUtils.ParseUrlQueryString 21 | { 22 | using Facebook; 23 | using Xunit; 24 | 25 | public class GivenAQuerystringWithCodeThen 26 | { 27 | [Fact] 28 | public void ItShouldDecodeCorrectly() 29 | { 30 | var queryString = "code=2.XeyH7lWz33itx1R86_uBeg__.3600.1294930800-100001327642026%7Ct8SsfSR2XI6yhBAkhX95J7p9hJ0"; 31 | 32 | var result = FacebookUtils.ParseUrlQueryString(queryString); 33 | 34 | Assert.Equal("2.XeyH7lWz33itx1R86_uBeg__.3600.1294930800-100001327642026|t8SsfSR2XI6yhBAkhX95J7p9hJ0", result["code"]); 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /Source/Facebook.Tests/FacebookUtils/ParseQueryParametersToDictionary/GivenAPathAsEmptyStringAndEmptyParametersThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.FacebookUtils.ParseQueryParametersToDictionary 21 | { 22 | using System.Collections.Generic; 23 | using Facebook; 24 | using Xunit; 25 | 26 | public class GivenAPathAsEmptyStringAndEmptyParametersThen 27 | { 28 | [Fact] 29 | public void CountOfParametersEquals0() 30 | { 31 | string path = string.Empty; 32 | var parameters = new Dictionary(); 33 | 34 | FacebookUtils.ParseQueryParametersToDictionary(path, parameters); 35 | 36 | Assert.Equal(0, parameters.Count); 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /Source/Facebook.Tests/FacebookUtils/ConvertToString/GivenANumberOutOfHttpMethodRangeThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.FacebookUtils.ConvertToString 21 | { 22 | using System; 23 | using Facebook; 24 | using Xunit; 25 | using Xunit.Extensions; 26 | 27 | public class GivenANumberOutOfHttpMethodRangeThen 28 | { 29 | [InlineData(-1)] 30 | [InlineData(3)] 31 | [InlineData(4)] 32 | [Theory] 33 | public void ItShouldThrowInvalidOperationException(int number) 34 | { 35 | var httpMethod = (HttpMethod)number; 36 | 37 | Assert.Throws( 38 | () => FacebookUtils.ConvertToString(httpMethod)); 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /Source/Facebook.Tests/FacebookUtils/ParseQueryParametersToDictionary/GivenAPathWithoutQuerystringAndEmptyParametersThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.FacebookUtils.ParseQueryParametersToDictionary 21 | { 22 | using System.Collections.Generic; 23 | using Facebook; 24 | using Xunit; 25 | 26 | public class GivenAPathWithoutQuerystringAndEmptyParametersThen 27 | { 28 | [Fact] 29 | public void CountOfParametersEquals0() 30 | { 31 | var path = "/me/likes"; 32 | var parameters = new Dictionary(); 33 | 34 | FacebookUtils.ParseQueryParametersToDictionary(path, parameters); 35 | 36 | Assert.Equal(0, parameters.Count); 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /Source/Facebook.Tests/ExceptionFactory/GetRestException/GivenANonEmptyDictionaryOfStringObjectThatDoesNotContainErrorCodeKeyThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.ExceptionFactory.GetRestException 21 | { 22 | using System.Collections.Generic; 23 | using Facebook; 24 | using Xunit; 25 | 26 | public class GivenANonEmptyDictionaryOfStringObjectThatDoesNotContainErrorCodeKeyThen 27 | { 28 | [Fact] 29 | public void ResultIsNull() 30 | { 31 | var dictWithoutErrorCodeKey = new Dictionary { { "dummy_key", "dummy_value" } }; 32 | 33 | var result = ExceptionFactory.GetRestException(dictWithoutErrorCodeKey); 34 | 35 | Assert.Null(result); 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /Source/Facebook.IntegrationTests/TypedObjectTests.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests 21 | { 22 | using Facebook.Graph; 23 | using Xunit; 24 | 25 | public class TypedObjectTests 26 | { 27 | private FacebookClient app; 28 | public TypedObjectTests() 29 | { 30 | app = new FacebookClient(); 31 | //app.Session = new FacebookSession 32 | //{ 33 | // AccessToken = ConfigurationManager.AppSettings["AccessToken"], 34 | //}; 35 | } 36 | 37 | [Fact] 38 | public void Get_User_Info_Typed() 39 | { 40 | var user = app.Get("/totten"); 41 | Assert.NotNull(user.FirstName); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Source/Facebook.Tests/FacebookUtils/IsUsingRestApi/GivenDomainMapsAsNull/AndRequestUriIsGraphUrlThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.FacebookUtils.IsUsingRestApi.GivenDomainMapsAsNull 21 | { 22 | using System; 23 | using Facebook; 24 | using Xunit; 25 | using Xunit.Extensions; 26 | 27 | public class AndRequestUriIsGraphUrlThen 28 | { 29 | [Theory] 30 | [InlineData("https://graph.facebook.com/me")] 31 | [InlineData("https://graph.beta.facebook.com/me")] 32 | public void ResultIsFalse(string url) 33 | { 34 | var uri = new Uri(url); 35 | 36 | var result = FacebookUtils.IsUsingRestApi(null, uri); 37 | 38 | Assert.False(result); 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /Source/Facebook.Tests/ExceptionFactory/GetGraphException/Object/GivenANonEmptyDictionaryOfStringObjectThatDoesNotContainErrorKeyThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.ExceptionFactory.GetGraphException.Object 21 | { 22 | using System.Collections.Generic; 23 | using Facebook; 24 | using Xunit; 25 | 26 | public class GivenANonEmptyDictionaryOfStringObjectThatDoesNotContainErrorKeyThen 27 | { 28 | [Fact] 29 | public void ResultIsNotNull() 30 | { 31 | var dictWithoutErrorCodeKey = new Dictionary { { "dummy_key", "dummy_value" } }; 32 | 33 | var result = ExceptionFactory.GetGraphException(dictWithoutErrorCodeKey); 34 | 35 | Assert.Null(result); 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /Source/Facebook.Tests/FacebookUtils/ParseUrlQueryString/GivenAQuerystringAsStringEmptyThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.FacebookUtils.ParseUrlQueryString 21 | { 22 | using Facebook; 23 | using Xunit; 24 | 25 | public class GivenAQuerystringAsStringEmptyThen 26 | { 27 | [Fact] 28 | public void TheResultShouldNotBeNull() 29 | { 30 | var result = FacebookUtils.ParseUrlQueryString(string.Empty); 31 | 32 | Assert.NotNull(result); 33 | } 34 | 35 | [Fact] 36 | public void TheCountOfResultShouldBe0() 37 | { 38 | var result = FacebookUtils.ParseUrlQueryString(string.Empty); 39 | 40 | Assert.Equal(0, result.Count); 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /Source/Facebook.Tests/FacebookUtils/UrlEncode/GivenAUrlEncodedCodeThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.FacebookUtils.UrlEncode 21 | { 22 | using Facebook; 23 | using Xunit; 24 | using Xunit.Extensions; 25 | 26 | public class GivenAUrlEncodedCodeThen 27 | { 28 | [InlineData("2.XeyH7lWz33itx1R86_uBeg__.3600.1294930800-100001327642026%7Ct8SsfSR2XI6yhBAkhX95J7p9hJ0", "2.XeyH7lWz33itx1R86_uBeg__.3600.1294930800-100001327642026|t8SsfSR2XI6yhBAkhX95J7p9hJ0")] 29 | [Theory] 30 | public void ItShouldDecodeCorrectly(string encodedCode, string expectedCode) 31 | { 32 | var result = FluentHttp.HttpHelper.UrlDecode(encodedCode); 33 | 34 | Assert.Equal(expectedCode, result); 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /Source/Facebook.Tests/FacebookUtils/ParseUrlQueryString/GivenAQueryStringWithErrorThenDescriptionContainingPlusSignThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.FacebookUtils.ParseUrlQueryString 21 | { 22 | using Facebook; 23 | using Xunit; 24 | 25 | public class GivenAQueryStringWithErrorThenDescriptionContainingPlusSignThen 26 | { 27 | [Fact] 28 | public void Error_descriptionShouldBeDecodedCorrectly() 29 | { 30 | var queryString = "error_reason=user_denied&error=access_denied&error_description=The+user+denied+your+request."; 31 | 32 | var result = FacebookUtils.ParseUrlQueryString(queryString); 33 | 34 | Assert.Equal("The user denied your request.", result["error_description"]); 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /Source/Facebook/HttpWebRequestCreatedEventArgs.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook 21 | { 22 | using System; 23 | 24 | class HttpWebRequestCreatedEventArgs : EventArgs 25 | { 26 | private readonly object _userToken; 27 | private readonly HttpWebRequestWrapper _httpWebRequestWrapper; 28 | 29 | public HttpWebRequestCreatedEventArgs(object userToken, HttpWebRequestWrapper httpWebRequestWrapper) 30 | { 31 | _userToken = userToken; 32 | _httpWebRequestWrapper = httpWebRequestWrapper; 33 | } 34 | 35 | public HttpWebRequestWrapper HttpWebRequest 36 | { 37 | get { return _httpWebRequestWrapper; } 38 | } 39 | 40 | public object UserState 41 | { 42 | get { return _userToken; } 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /Source/Facebook.Tests/FacebookUtils/ParseUrlQueryString/GivenAQuerystringAsWhitespaceThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.FacebookUtils.ParseUrlQueryString 21 | { 22 | using Facebook; 23 | using Xunit; 24 | 25 | public class GivenAQuerystringAsWhitespaceThen 26 | { 27 | [Fact] 28 | public void ResultShouldNotBeNull() 29 | { 30 | string whiteSpaceQueryString = " "; 31 | var result = FacebookUtils.ParseUrlQueryString(whiteSpaceQueryString); 32 | 33 | Assert.NotNull(result); 34 | } 35 | 36 | [Fact] 37 | public void TheCountOfResultShouldBe0() 38 | { 39 | string whiteSpaceQueryString = " "; 40 | var result = FacebookUtils.ParseUrlQueryString(whiteSpaceQueryString); 41 | 42 | Assert.Equal(0, result.Count); 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /Source/Facebook.Tests/FacebookUtils/DropQueryParametersTests.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.FacebookUtils 21 | { 22 | using Facebook; 23 | using Xunit; 24 | 25 | public class DropQueryParametersTests 26 | { 27 | [Fact] 28 | public void CountIs2() 29 | { 30 | var result = FacebookUtils.DropQueryParameters.Count; 31 | 32 | Assert.Equal(2, result); 33 | } 34 | 35 | [Fact] 36 | public void ContainsSession() 37 | { 38 | var result = FacebookUtils.DropQueryParameters.Contains("session"); 39 | 40 | Assert.True(result); 41 | } 42 | 43 | [Fact] 44 | public void ContainsSignedRequest() 45 | { 46 | var result = FacebookUtils.DropQueryParameters.Contains("signed_request"); 47 | 48 | Assert.True(result); 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /Source/Facebook.Tests/FacebookClient/GetApiUrl/GivenMethodIsNotAllSmallLetterThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.FacebookClient.GetApiUrl 21 | { 22 | using Tests.FacebookClient.GetApiUrl.Fakes; 23 | using Xunit; 24 | 25 | public class GivenMethodIsNotAllSmallLetterThen 26 | { 27 | [Fact] 28 | public void VideoUploadTests() 29 | { 30 | var fb = new FakeFacebookClient(); 31 | 32 | var uri = fb.GetApiUrl("video.Upload"); 33 | 34 | Assert.Equal("https://api-video.facebook.com/restserver.php", uri.AbsoluteUri); 35 | } 36 | 37 | [Fact] 38 | public void ReadOnlyApiCalls() 39 | { 40 | var fb = new FakeFacebookClient(); 41 | 42 | var uri = fb.GetApiUrl("users.GetStandardinfo"); 43 | 44 | Assert.Equal("https://api-read.facebook.com/restserver.php", uri.AbsoluteUri); 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /Source/Facebook.Tests/FacebookClient/ExtractMediaObject/GivenNullParametersThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | using System.Collections.Generic; 21 | using Xunit; 22 | 23 | namespace Facebook.Tests.FacebookClient.ExtractMediaObject 24 | { 25 | using Facebook; 26 | 27 | public class GivenNullParametersThen 28 | { 29 | private IDictionary _parameters; 30 | 31 | public GivenNullParametersThen() 32 | { 33 | _parameters = null; 34 | } 35 | 36 | [Fact] 37 | public void ReturnValueIsNotNull() 38 | { 39 | var result = FacebookClient.ExtractMediaObjects(_parameters); 40 | 41 | Assert.NotNull(result); 42 | } 43 | 44 | [Fact] 45 | public void CountIs0() 46 | { 47 | var result = FacebookClient.ExtractMediaObjects(_parameters); 48 | 49 | Assert.Equal(0, result.Count); 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /Source/Facebook.Tests/ExceptionFactory/GetRestException/GivenNonNullInputNotOfTypeIDictionaryStringObjectThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.ExceptionFactory.GetRestException 21 | { 22 | using System.Collections.Generic; 23 | using Facebook; 24 | using Xunit; 25 | using Xunit.Extensions; 26 | 27 | public class GivenNonNullInputNotOfTypeIDictionaryStringObjectThen 28 | { 29 | [Theory] 30 | [PropertyData("TestData")] 31 | public void ResultIsNull(object input) 32 | { 33 | var result = ExceptionFactory.GetRestException(input); 34 | 35 | Assert.Null(result); 36 | } 37 | 38 | public static IEnumerable TestData 39 | { 40 | get 41 | { 42 | yield return new object[] { "this_is_not_dictionary" }; 43 | yield return new object[] { 1 }; 44 | } 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /Source/Facebook.Tests/ExceptionFactory/GetGraphException/Object/GivenNonNullInputNotOfTypeIDictionaryStringObjectThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.ExceptionFactory.GetGraphException.Object 21 | { 22 | using System.Collections.Generic; 23 | using Facebook; 24 | using Xunit; 25 | using Xunit.Extensions; 26 | 27 | public class GivenNonNullInputNotOfTypeIDictionaryStringObjectThen 28 | { 29 | [Theory] 30 | [PropertyData("TestData")] 31 | public void ResultIsNull(object input) 32 | { 33 | var result = ExceptionFactory.GetGraphException(input); 34 | 35 | Assert.Null(result); 36 | } 37 | 38 | public static IEnumerable TestData 39 | { 40 | get 41 | { 42 | yield return new object[] { "this_is_not_dictionary" }; 43 | yield return new object[] { 1 }; 44 | } 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /Source/Facebook.Tests/FacebookClient/ExtractMediaObject/GivenEmptyParametersThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | using System.Collections.Generic; 21 | using Xunit; 22 | 23 | namespace Facebook.Tests.FacebookClient.ExtractMediaObject 24 | { 25 | using Facebook; 26 | 27 | public class GivenEmptyParametersThen 28 | { 29 | private IDictionary _parameters; 30 | 31 | public GivenEmptyParametersThen() 32 | { 33 | _parameters = new Dictionary(); 34 | } 35 | 36 | [Fact] 37 | public void ReturnValueIsNotNull() 38 | { 39 | var result = FacebookClient.ExtractMediaObjects(_parameters); 40 | 41 | Assert.NotNull(result); 42 | } 43 | 44 | [Fact] 45 | public void CountIs0() 46 | { 47 | var result = FacebookClient.ExtractMediaObjects(_parameters); 48 | 49 | Assert.Equal(0, result.Count); 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /Source/Facebook.Tests/FacebookUtils/Merge/WhenBothInputsAreNullThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.FacebookUtils.Merge 21 | { 22 | using System.Collections.Generic; 23 | using Facebook; 24 | using Xunit; 25 | 26 | public class WhenBothInputsAreNullThen 27 | { 28 | [Fact] 29 | public void TheResultShouldNotBeNull() 30 | { 31 | IDictionary first = null; 32 | IDictionary second = null; 33 | 34 | var result = FacebookUtils.Merge(first, second); 35 | 36 | Assert.NotNull(result); 37 | } 38 | 39 | [Fact] 40 | public void TheCountOfResultShouldBe0() 41 | { 42 | IDictionary first = null; 43 | IDictionary second = null; 44 | 45 | var result = FacebookUtils.Merge(first, second); 46 | 47 | Assert.Equal(0, result.Count); 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /Source/Facebook-WP7.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook-WP7", "Facebook\Facebook-WP7.csproj", "{857E540C-0092-4590-A279-F98A6B77AC0A}" 5 | EndProject 6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{1B1AC736-460A-46B5-B786-DD30C13AE755}" 7 | ProjectSection(SolutionItems) = preProject 8 | .nuget\NuGet.exe = .nuget\NuGet.exe 9 | .nuget\NuGet.targets = .nuget\NuGet.targets 10 | EndProjectSection 11 | EndProject 12 | Global 13 | GlobalSection(TestCaseManagementSettings) = postSolution 14 | CategoryFile = Facebook.vsmdi 15 | EndGlobalSection 16 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 17 | Debug|Any CPU = Debug|Any CPU 18 | Debug|Mixed Platforms = Debug|Mixed Platforms 19 | Debug|x86 = Debug|x86 20 | Release|Any CPU = Release|Any CPU 21 | Release|Mixed Platforms = Release|Mixed Platforms 22 | Release|x86 = Release|x86 23 | EndGlobalSection 24 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 25 | {857E540C-0092-4590-A279-F98A6B77AC0A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 26 | {857E540C-0092-4590-A279-F98A6B77AC0A}.Debug|Any CPU.Build.0 = Debug|Any CPU 27 | {857E540C-0092-4590-A279-F98A6B77AC0A}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU 28 | {857E540C-0092-4590-A279-F98A6B77AC0A}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU 29 | {857E540C-0092-4590-A279-F98A6B77AC0A}.Debug|x86.ActiveCfg = Debug|Any CPU 30 | {857E540C-0092-4590-A279-F98A6B77AC0A}.Release|Any CPU.ActiveCfg = Release|Any CPU 31 | {857E540C-0092-4590-A279-F98A6B77AC0A}.Release|Any CPU.Build.0 = Release|Any CPU 32 | {857E540C-0092-4590-A279-F98A6B77AC0A}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU 33 | {857E540C-0092-4590-A279-F98A6B77AC0A}.Release|Mixed Platforms.Build.0 = Release|Any CPU 34 | {857E540C-0092-4590-A279-F98A6B77AC0A}.Release|x86.ActiveCfg = Release|Any CPU 35 | EndGlobalSection 36 | GlobalSection(SolutionProperties) = preSolution 37 | HideSolutionNode = FALSE 38 | EndGlobalSection 39 | EndGlobal 40 | -------------------------------------------------------------------------------- /Source/Facebook-Net35.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook-Net35", "Facebook\Facebook-Net35.csproj", "{857E540C-0092-4590-A279-F98A6B77AC0A}" 5 | EndProject 6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{54546001-AE7F-4456-AB85-E2AED61722CB}" 7 | ProjectSection(SolutionItems) = preProject 8 | .nuget\NuGet.exe = .nuget\NuGet.exe 9 | .nuget\NuGet.targets = .nuget\NuGet.targets 10 | EndProjectSection 11 | EndProject 12 | Global 13 | GlobalSection(TestCaseManagementSettings) = postSolution 14 | CategoryFile = Facebook.vsmdi 15 | EndGlobalSection 16 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 17 | Debug|Any CPU = Debug|Any CPU 18 | Debug|Mixed Platforms = Debug|Mixed Platforms 19 | Debug|x86 = Debug|x86 20 | Release|Any CPU = Release|Any CPU 21 | Release|Mixed Platforms = Release|Mixed Platforms 22 | Release|x86 = Release|x86 23 | EndGlobalSection 24 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 25 | {857E540C-0092-4590-A279-F98A6B77AC0A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 26 | {857E540C-0092-4590-A279-F98A6B77AC0A}.Debug|Any CPU.Build.0 = Debug|Any CPU 27 | {857E540C-0092-4590-A279-F98A6B77AC0A}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU 28 | {857E540C-0092-4590-A279-F98A6B77AC0A}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU 29 | {857E540C-0092-4590-A279-F98A6B77AC0A}.Debug|x86.ActiveCfg = Debug|Any CPU 30 | {857E540C-0092-4590-A279-F98A6B77AC0A}.Release|Any CPU.ActiveCfg = Release|Any CPU 31 | {857E540C-0092-4590-A279-F98A6B77AC0A}.Release|Any CPU.Build.0 = Release|Any CPU 32 | {857E540C-0092-4590-A279-F98A6B77AC0A}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU 33 | {857E540C-0092-4590-A279-F98A6B77AC0A}.Release|Mixed Platforms.Build.0 = Release|Any CPU 34 | {857E540C-0092-4590-A279-F98A6B77AC0A}.Release|x86.ActiveCfg = Release|Any CPU 35 | EndGlobalSection 36 | GlobalSection(SolutionProperties) = preSolution 37 | HideSolutionNode = FALSE 38 | EndGlobalSection 39 | EndGlobal 40 | -------------------------------------------------------------------------------- /Source/Facebook.Tests/FacebookUtils/Merge/WhenBothInputsAreEmptyAndNotNullThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.FacebookUtils.Merge 21 | { 22 | using System.Collections.Generic; 23 | using Facebook; 24 | using Xunit; 25 | 26 | public class WhenBothInputsAreEmptyAndNotNullThen 27 | { 28 | [Fact] 29 | public void ResultShouldNotBeNull() 30 | { 31 | var first = new Dictionary(); 32 | var second = new Dictionary(); 33 | 34 | var result = FacebookUtils.Merge(first, second); 35 | 36 | Assert.NotNull(result); 37 | } 38 | 39 | [Fact] 40 | public void TheCountOfResultShouldBe0() 41 | { 42 | var first = new Dictionary(); 43 | var second = new Dictionary(); 44 | 45 | var result = FacebookUtils.Merge(first, second); 46 | 47 | Assert.Equal(0, result.Count); 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /Source/Facebook.Tests/FacebookUtils/ParseQueryParametersToDictionary/GivenAPathWithQueryStringShouldUrlDecodeCorrectly.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.FacebookUtils.ParseQueryParametersToDictionary 21 | { 22 | using System.Collections.Generic; 23 | using Xunit; 24 | 25 | public class GivenAPathWithQueryStringShouldUrlDecodeCorrectly 26 | { 27 | [Fact] 28 | public void UrlDecodesCorrectly() 29 | { 30 | string pathWithQuerystring = "/me?access_token=124973702%7cc6d91d1492d6d1a.1-6306%7cpLl4mEfII18sA"; 31 | var parameters = new Dictionary(); 32 | 33 | var path = Facebook.FacebookUtils.ParseQueryParametersToDictionary(pathWithQuerystring, parameters); 34 | 35 | Assert.Equal(path, "me"); 36 | Assert.NotNull(parameters); 37 | Assert.Equal(1, parameters.Count); 38 | Assert.Equal("124973702|c6d91d1492d6d1a.1-6306|pLl4mEfII18sA", parameters["access_token"]); 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /Source/Facebook.Tests/FacebookUtils/ToJsonQueryString/GivenADateTimeWithTimeZoneThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.FacebookUtils.ToJsonQueryString 21 | { 22 | using System; 23 | using Facebook; 24 | using Xunit; 25 | 26 | public class GivenADateTimeWithTimeZoneThen 27 | { 28 | #if !SILVERLIGHT 29 | 30 | [Fact(Skip = "in bangkok, thailand the result is +07:00 and thus fails")] 31 | public void ShouldSerializeItCorrectlyToISO8601DateTimeFormat() 32 | { 33 | // We create the datetime this way so that this test passes in all time zones 34 | var dateTime = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(new DateTime(2010, 6, 15, 0, 0, 0, DateTimeKind.Utc), TimeZoneInfo.Utc.Id, "Central Standard Time"); 35 | var result = JsonSerializer.Current.SerializeObject(dateTime); 36 | 37 | // TODO: fix - in bangkok, thailand the result is +07:00 and thus fails 38 | Assert.Equal("\"2010-06-14T19:00:00-04:00\"", result); 39 | } 40 | #endif 41 | } 42 | } -------------------------------------------------------------------------------- /Source/Facebook.Tests/FacebookClient/GetApiUrl/Fakes/FakeFacebookClient.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.FacebookClient.GetApiUrl.Fakes 21 | { 22 | using System; 23 | using System.Collections.Generic; 24 | using Facebook; 25 | 26 | class FakeFacebookClient : FacebookClient 27 | { 28 | #region not implemented 29 | 30 | #if !SILVERLIGHT 31 | 32 | internal protected override object Api(string path, IDictionary parameters, HttpMethod httpMethod, Type resultType) 33 | { 34 | throw new NotImplementedException(); 35 | } 36 | 37 | #endif 38 | 39 | internal protected override void ApiAsync(string path, IDictionary parameters, HttpMethod httpMethod, object userToken) 40 | { 41 | throw new NotImplementedException(); 42 | } 43 | 44 | #endregion 45 | 46 | public new System.Uri GetApiUrl(string method) 47 | { 48 | return base.GetApiUrl(method); 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /Source/Facebook.Tests/FacebookUtils/ParseQueryParametersToDictionary/GivenAPathStartingWithForwardSlashAndNoQueryStringAndEmptyParametersThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.FacebookUtils.ParseQueryParametersToDictionary 21 | { 22 | using System.Collections.Generic; 23 | using Facebook; 24 | using Xunit; 25 | 26 | public class GivenAPathStartingWithForwardSlashAndNoQueryStringAndEmptyParametersThen 27 | { 28 | [Fact(DisplayName = "ParseUrlParameters: Given a path starting with Forward slash and empty parameters Then return path equals the path without forward slash")] 29 | public void ReturnPathEqualsThePathWithoutForwardSlash() 30 | { 31 | string originalPath = "/me/likes"; 32 | string pathWithoutForwardSlash = "me/likes"; 33 | var parameters = new Dictionary(); 34 | 35 | var path = FacebookUtils.ParseQueryParametersToDictionary(originalPath, parameters); 36 | 37 | Assert.Equal(pathWithoutForwardSlash, path); 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /Source/Facebook.Tests/HttpHelperTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text; 3 | using Xunit; 4 | 5 | namespace Facebook.Tests 6 | { 7 | public class HttpHelperTests 8 | { 9 | public class UrlEncodeTests 10 | { 11 | [Fact] 12 | public void UrlEncodeDoesNotThrow() 13 | { 14 | var sb = new StringBuilder(); 15 | for (int i = 0; i <= 100000; i++) 16 | { 17 | sb.Append("a"); 18 | } 19 | Assert.DoesNotThrow(() => HttpHelper.UrlEncode(sb.ToString())); 20 | } 21 | 22 | [Fact] 23 | public void UrlEncodeEncodes1000Chars() 24 | { 25 | var charCount = 1000; 26 | 27 | UrlEncodeEncodes(charCount); 28 | } 29 | 30 | [Fact] 31 | public void UrlEncodeEncodesMoreThan1000Chars() 32 | { 33 | var charCount = 10001; 34 | 35 | UrlEncodeEncodes(charCount); 36 | } 37 | 38 | private void UrlEncodeEncodes(int charCount) 39 | { 40 | var sb = new StringBuilder(charCount); 41 | var sbVerification = new StringBuilder(3 * charCount); 42 | 43 | for (int i = 0; i < charCount; i++) 44 | { 45 | sb.Append("/"); 46 | sbVerification.Append("%2F"); 47 | } 48 | 49 | var result = HttpHelper.UrlEncode(sb.ToString()); 50 | 51 | Assert.True(sbVerification.ToString().Equals(result, StringComparison.InvariantCultureIgnoreCase)); 52 | } 53 | 54 | [Fact] 55 | public void UrlEncodeNullString() 56 | { 57 | Assert.Throws(() => HttpHelper.UrlEncode(null)); 58 | } 59 | 60 | [Fact] 61 | public void UrlEncodeEmptyString() 62 | { 63 | var result = HttpHelper.UrlEncode(""); 64 | Assert.Equal("", result); 65 | } 66 | } 67 | 68 | } 69 | } -------------------------------------------------------------------------------- /Source/Facebook.Tests/FacebookUtils/Merge/WhenFirstInputIsNullAndSecondIsEmptyAndNotNullThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.FacebookUtils.Merge 21 | { 22 | using System.Collections.Generic; 23 | using Facebook; 24 | using Xunit; 25 | 26 | public class WhenFirstInputIsNullAndSecondIsEmptyAndNotNullThen 27 | { 28 | [Fact] 29 | public void ResultShouldNotBeNull() 30 | { 31 | IDictionary first = null; 32 | IDictionary second = new Dictionary(); 33 | 34 | var result = FacebookUtils.Merge(first, second); 35 | 36 | Assert.NotNull(result); 37 | } 38 | 39 | [Fact] 40 | public void TheCountOfResultShouldBe0() 41 | { 42 | IDictionary first = null; 43 | IDictionary second = new Dictionary(); 44 | 45 | var result = FacebookUtils.Merge(first, second); 46 | 47 | Assert.Equal(0, result.Count); 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /Source/Facebook.Tests/FacebookUtils/Merge/WhenFirstInputIsEmptyAndNotNullAndSecondInputIsNullThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.FacebookUtils.Merge 21 | { 22 | using System.Collections.Generic; 23 | using Facebook; 24 | using Xunit; 25 | 26 | public class WhenFirstInputIsEmptyAndNotNullAndSecondInputIsNullThen 27 | { 28 | [Fact] 29 | public void TheResultShouldNotBeNull() 30 | { 31 | IDictionary first = new Dictionary(); 32 | IDictionary second = null; 33 | 34 | var result = FacebookUtils.Merge(first, second); 35 | 36 | Assert.NotNull(result); 37 | } 38 | 39 | [Fact] 40 | public void TheCountOfTheResultShouldBe0() 41 | { 42 | IDictionary first = new Dictionary(); 43 | IDictionary second = null; 44 | 45 | var result = FacebookUtils.Merge(first, second); 46 | 47 | Assert.Equal(0, result.Count); 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /Source/Facebook.Tests/FacebookUtils/ToJsonQueryString/WhenObjectDictionaryContainsObjectAsListOfStringThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.FacebookUtils.ToJsonQueryString 21 | { 22 | using System.Collections.Generic; 23 | using Facebook; 24 | using Xunit; 25 | 26 | public class WhenObjectDictionaryContainsObjectAsListOfStringThen 27 | { 28 | [Fact] 29 | public void ItShouldBeDecodedWithSquareBrackets() 30 | { 31 | var dict = new Dictionary 32 | { 33 | {"key1", "value1"}, 34 | {"key2", "value2"}, 35 | {"key3", new List {"list_item1", "list_item2"}} 36 | }; 37 | 38 | // key1=value1&key2=value2&key3=["list_item1","list_item2"] 39 | var expected = "key1=value1&key2=value2&key3=%5B%22list_item1%22%2C%22list_item2%22%5D"; 40 | 41 | var result = FacebookUtils.ToJsonQueryString(dict); 42 | 43 | Assert.Equal(expected, result); 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /Source/Facebook.IntegrationTests/RestReadTests.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.Rest 21 | { 22 | using System.Configuration; 23 | using System.Dynamic; 24 | using Xunit; 25 | 26 | public class RestReadTests 27 | { 28 | private FacebookClient app; 29 | public RestReadTests() 30 | { 31 | app = new FacebookClient(); 32 | app.AccessToken = ConfigurationManager.AppSettings["AccessToken"]; 33 | } 34 | 35 | [Fact] 36 | public void user_getInfo_rest_should_throw_oauth() 37 | { 38 | dynamic parameters = new ExpandoObject(); 39 | parameters.method = "user.getInfo"; 40 | parameters.uids = "14812017"; 41 | parameters.fields = "first_name,last_name"; 42 | parameters.access_token = "invalidtoken"; 43 | 44 | Assert.Throws( 45 | () => 46 | { 47 | var result = app.Get(parameters); 48 | // var firstName = result[0].first_name; 49 | }); 50 | } 51 | 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Source/Facebook.Tests/FacebookUtils/UrlDecode/GivenAUrlEncodedFacebookAccessTokenThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.FacebookUtils.UrlDecode 21 | { 22 | using Facebook; 23 | using Xunit; 24 | using Xunit.Extensions; 25 | 26 | public class GivenAUrlEncodedFacebookAccessTokenThen 27 | { 28 | [InlineData("124983200973703%7C2.xZYnCri_odnkuj3xXUNDOA__.3600.1295836200-100001327642026%7CrPfJfZ38FcwV-8HzRGQdxio9D7B", "124983200973703|2.xZYnCri_odnkuj3xXUNDOA__.3600.1295836200-100001327642026|rPfJfZ38FcwV-8HzRGQdxio9D7B")] 29 | [InlineData("135972300873702%7C3.cxZrSyyPVHjISXQCB8MQ_g__.3600.1294833600-100001327642025%7Cjbo3zk3aHYVJiLWnKArjERsAU0c", "135972300873702|3.cxZrSyyPVHjISXQCB8MQ_g__.3600.1294833600-100001327642025|jbo3zk3aHYVJiLWnKArjERsAU0c")] 30 | [Theory(DisplayName = "UrlDecode: Given a url encoded facebook access token Then it should decode correctly")] 31 | public void ItShouldDecodeCorrectly(string encodedAccessToken, string expectedAccessToken) 32 | { 33 | var result = FluentHttp.HttpHelper.UrlDecode(encodedAccessToken); 34 | 35 | Assert.Equal(expectedAccessToken, result); 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /Source/Facebook/FacebookClient.Batch.Sync.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook 21 | { 22 | public partial class FacebookClient 23 | { 24 | /// 25 | /// Makes a batch request to the Facebook server. 26 | /// 27 | /// 28 | /// List of batch parameters. 29 | /// 30 | /// 31 | /// The json result. 32 | /// 33 | public virtual object Batch(params FacebookBatchParameter[] batchParameters) 34 | { 35 | return Batch(batchParameters, null); 36 | } 37 | 38 | /// 39 | /// Makes a batch request to the Facebook server. 40 | /// 41 | /// List of batch parameters. 42 | /// The parameters 43 | /// The json result. 44 | public virtual object Batch(FacebookBatchParameter[] batchParameters, object parameters) 45 | { 46 | var actualParameter = PrepareBatchRequest(batchParameters, parameters); 47 | return Post(actualParameter); 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /Source/Facebook/TaskExtensions.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook 21 | { 22 | using System; 23 | using System.Threading.Tasks; 24 | 25 | static class TaskExtensions 26 | { 27 | public static Task Then(this Task first, Func next) 28 | { 29 | if (first == null) throw new ArgumentNullException("first"); 30 | if (next == null) throw new ArgumentNullException("next"); 31 | 32 | var tcs = new TaskCompletionSource(); 33 | first.ContinueWith(delegate 34 | { 35 | if (first.IsFaulted) tcs.TrySetException(first.Exception.InnerExceptions); 36 | else if (first.IsCanceled) tcs.TrySetCanceled(); 37 | else 38 | { 39 | try 40 | { 41 | var result = next(first.Result); 42 | tcs.TrySetResult(result); 43 | } 44 | catch (Exception ex) 45 | { 46 | tcs.TrySetException(ex); 47 | } 48 | } 49 | }); 50 | return tcs.Task; 51 | } 52 | } 53 | } -------------------------------------------------------------------------------- /Source/Facebook.Tests/FacebookUtils/ToJsonQueryString/GivenAFQLQueryThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.FacebookUtils.ToJsonQueryString 21 | { 22 | using Facebook; 23 | using System.Dynamic; 24 | using Xunit; 25 | using System.Collections.Generic; 26 | 27 | public class GivenAFQLQueryThen 28 | { 29 | [Fact] 30 | public void ShouldSerializeItCorrectly() 31 | { 32 | dynamic attachment = new ExpandoObject(); 33 | attachment.name = "my attachment"; 34 | attachment.href = "http://apps.facebook.com/canvas"; 35 | 36 | dynamic parameters = new ExpandoObject(); 37 | parameters.method = "stream.publish"; 38 | parameters.message = "my message"; 39 | parameters.attachment = attachment; 40 | 41 | #if SILVERLIGHT 42 | string result = FacebookUtils.ToJsonQueryString((IDictionary)parameters); 43 | #else 44 | string result = FacebookUtils.ToJsonQueryString(parameters); 45 | #endif 46 | Assert.Equal("method=stream.publish&message=my%20message&attachment=%7B%22name%22%3A%22my%20attachment%22%2C%22href%22%3A%22http%3A%2F%2Fapps.facebook.com%2Fcanvas%22%7D", result); 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /Source/Facebook.Tests/FacebookUtils/ToJsonQueryString/GivenAnObjectWithASecondLevelThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.FacebookUtils.ToJsonQueryString 21 | { 22 | using Facebook; 23 | using System.Collections.Generic; 24 | using System.Dynamic; 25 | using Xunit; 26 | 27 | public class GivenAnObjectWithASecondLevelThen 28 | { 29 | [Fact] 30 | public void ShouldSerializeItCorrectly() 31 | { 32 | dynamic attachment = new ExpandoObject(); 33 | attachment.name = "my attachment"; 34 | attachment.href = "http://apps.facebook.com/canvas"; 35 | 36 | dynamic parameters = new ExpandoObject(); 37 | parameters.method = "stream.publish"; 38 | parameters.message = "my message"; 39 | parameters.attachment = attachment; 40 | 41 | #if SILVERLIGHT 42 | string result = FacebookUtils.ToJsonQueryString((IDictionary)parameters); 43 | #else 44 | string result = FacebookUtils.ToJsonQueryString(parameters); 45 | #endif 46 | Assert.Equal("method=stream.publish&message=my%20message&attachment=%7B%22name%22%3A%22my%20attachment%22%2C%22href%22%3A%22http%3A%2F%2Fapps.facebook.com%2Fcanvas%22%7D", result); 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /Source/Facebook.Tests/FacebookClient/ExtractMediaObject/GiveOneMediaObjectOnlyThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | using System.Collections.Generic; 21 | using Xunit; 22 | 23 | namespace Facebook.Tests.FacebookClient.ExtractMediaObject 24 | { 25 | using Facebook; 26 | 27 | public class GiveOneMediaObjectOnlyThen 28 | { 29 | private IDictionary _parameters; 30 | 31 | public GiveOneMediaObjectOnlyThen() 32 | { 33 | _parameters = new Dictionary(); 34 | _parameters["source"] = new FacebookMediaObject(); 35 | } 36 | 37 | [Fact] 38 | public void ResultIsNotNull() 39 | { 40 | var result = FacebookClient.ExtractMediaObjects(_parameters); 41 | 42 | Assert.NotNull(result); 43 | } 44 | 45 | [Fact] 46 | public void ResultCountIs1() 47 | { 48 | var result = FacebookClient.ExtractMediaObjects(_parameters); 49 | 50 | Assert.Equal(1, result.Count); 51 | } 52 | 53 | [Fact] 54 | public void ParametersCountIs0() 55 | { 56 | var result = FacebookClient.ExtractMediaObjects(_parameters); 57 | 58 | Assert.Equal(0, _parameters.Count); 59 | } 60 | } 61 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Facebook SDK for .NET 2 | The Facebook SDK for .NET helps developers build web, desktop, Silverlight, Windows Phone and Windows Store applications that integrate with Facebook. 3 | 4 | [Like us on Facebook at our official page](http://facebook.com/csharpsdk) or [Follow us on twitter @chsarpsdk](http://twitter.com/csharpsdk). 5 | 6 | ## NuGet 7 | 8 | Install-Package Facebook 9 | 10 | *The Facebook SDK for .NET binaries are only distributed via nuget. For those using older versions of Visual Studio that 11 | does not support NuGet Package Manager, please download the [command line version of NuGet.exe](http://nuget.codeplex.com/releases/view/58939) and run the following 12 | command.* 13 | 14 | nuget install Facebook 15 | 16 | If you would like to get an older version of the the binaries please use the following command. 17 | 18 | nuget install Facebook -v 5.4.1 19 | 20 | ## Documentation 21 | You can find the documentation for this project at [http://facebooksdk.net](http://facebooksdk.net). 22 | 23 | ## Help and Support 24 | Use [facebook.stackoverflow.com](http://facebook.stackoverflow.com) for help and support. We answer questions there regularly. Use the tags '[facebook-c#-sdk](http://stackoverflow.com/questions/tagged/facebook-c%23-sdk)' and '[facebook](http://stackoverflow.com/questions/tagged/facebook)' plus any other tags that are relevant. If you have a feature request or bug create an issue. 25 | 26 | [Facebook Platform Status](https://developers.facebook.com/live_status) 27 | 28 | [Facebook Change Log](https://developers.facebook.com/docs/changelog/) 29 | 30 | ## Features 31 | * NuGet Packages Available ([Facebook](http://nuget.org/packages/Facebook) and [Facebook.channel](http://nuget.org/packages/Facebook.channel)) 32 | * Compatible with all Facebook Graph and REST API methods. 33 | * Supports photo/video uploads 34 | * Supports batch requests and etags 35 | * Supports Facebook's most current authentication systems. 36 | * Sample applications and documentation are provided to get you started quickly. 37 | 38 | ## Supported Platforms 39 | * .NET 3.5 (Client Profile and Full Profile) 40 | * .NET 4.0 (Client Profile and Full Profile) 41 | * .NET 4.5 42 | * Windows Store Apps 43 | * Silverlight 5 44 | * Windows Phone 7.1 45 | * Windows Phone 8 46 | 47 | ## Contribute 48 | 49 | Please refer to our official docs on [Contributing to Facebook SDK for .NET](http://facebooksdk.net/docs/contribute) for more details. 50 | -------------------------------------------------------------------------------- /Source/Facebook.Tests/FacebookUtils/ParseUrlQueryString/GivenAQueryStringWithAcessTokenAndExpiresInThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.FacebookUtils.ParseUrlQueryString 21 | { 22 | using Facebook; 23 | using Xunit; 24 | 25 | public class GivenAQueryStringWithAcessTokenAndExpiresInThen 26 | { 27 | [Fact] 28 | public void AccessTokenShouldBeDecodedCorrectly() 29 | { 30 | var queryString = 31 | "access_token=124973200873702%7C2.16KX_wTFlY2IAvWucsCKWA__.3600.1294927200-100001327642026%7CERLPsyFd8CP4ZI57VzAn0nl6WXo&expires_in=3699"; 32 | 33 | var result = FacebookUtils.ParseUrlQueryString(queryString); 34 | 35 | Assert.Equal("124973200873702|2.16KX_wTFlY2IAvWucsCKWA__.3600.1294927200-100001327642026|ERLPsyFd8CP4ZI57VzAn0nl6WXo", result["access_token"]); 36 | } 37 | 38 | [Fact] 39 | public void ExpiresInShouldBeDecodedCorrectly() 40 | { 41 | var queryString = 42 | "access_token=124973200873702%7C2.16KX_wTFlY2IAvWucsCKWA__.3600.1294927200-100001327642026%7CERLPsyFd8CP4ZI57VzAn0nl6WXo&expires_in=3699"; 43 | 44 | var result = FacebookUtils.ParseUrlQueryString(queryString); 45 | 46 | Assert.Equal("3699", result["expires_in"]); 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /Build/readme.txt: -------------------------------------------------------------------------------- 1 | # Facebook C# SDK 2 | The Facebook C# SDK helps .Net developers build web, desktop, Silverlight, Windows Phone and Windows 8 Store applications that integrate with Facebook. 3 | 4 | [Like us on Facebook at our official page](http://facebook.com/csharpsdk) or [Follow us on twitter @chsarpsdk](http://twitter.com/csharpsdk). 5 | 6 | ## NuGet 7 | 8 | Install-Package Facebook 9 | 10 | *Binaries for Facebook C# SDK are only distributed via nuget. For those using older versions of Visual Studio that 11 | does not support NuGet Package Manager, please download the [command line version of NuGet.exe](http://nuget.codeplex.com/releases/view/58939) and run the following 12 | command.* 13 | 14 | nuget install Facebook 15 | 16 | If you would like to get an older version of the the binaries please use the following command. 17 | 18 | nuget install Facebook -v 5.4.1 19 | 20 | ## Documentation 21 | You can find the documentation for this project at [http://csharpsdk.org](http://csharpsdk.org). 22 | 23 | ## Help and Support 24 | Use [facebook.stackoverflow.com](http://facebook.stackoverflow.com) for help and support. We answer questions there regularly. Use the tags '[facebook-c#-sdk](http://stackoverflow.com/questions/tagged/facebook-c%23-sdk)' and '[facebook](http://stackoverflow.com/questions/tagged/facebook)' plus any other tags that are relevant. If you have a feature request or bug create an issue. 25 | 26 | [Facebook Platform Status](https://developers.facebook.com/live_status) 27 | 28 | [Facebook Change Log](https://developers.facebook.com/docs/changelog/) 29 | 30 | ## Features 31 | * NuGet Packages Available ([Facebook](http://nuget.org/packages/Facebook) and [Facebook.channel](http://nuget.org/packages/Facebook.channel)) 32 | * Compatible with all Facebook Graph and REST API methods. 33 | * Supports photo/video uploads 34 | * Supports batch requests and etags 35 | * Supports Facebook's most current authentication systems. 36 | * Sample applications and documentation are provided to get you started quickly. 37 | 38 | ## Supported Platforms 39 | * .NET 3.5 (Client Profile and Full Profile) 40 | * .NET 4.0 (Client Profile and Full Profile) 41 | * .NET 4.5 42 | * Windows 8 Store Apps 43 | * Silverlight 5 44 | * Windows Phone 7.1 45 | * Windows Phone 8 46 | 47 | ## Contribute 48 | 49 | Please refer to our official docs on [Contributing to Facebook C# SDK](http://csharpsdk.org/docs/contribute) for more details. 50 | -------------------------------------------------------------------------------- /Source/Facebook-Net45.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2012 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook-Net45", "Facebook\Facebook-Net45.csproj", "{857E540C-0092-4590-A279-F98A6B77AC0A}" 5 | EndProject 6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{73EF7C1F-BE73-43D5-8F77-D2909DAA54A2}" 7 | ProjectSection(SolutionItems) = preProject 8 | ..\CHANGES.txt = ..\CHANGES.txt 9 | ..\jakefile.js = ..\jakefile.js 10 | ..\README.md = ..\README.md 11 | ..\VERSION = ..\VERSION 12 | EndProjectSection 13 | EndProject 14 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{EF20E8A3-68F4-4EAB-926E-3601E887F98B}" 15 | ProjectSection(SolutionItems) = preProject 16 | .nuget\NuGet.exe = .nuget\NuGet.exe 17 | .nuget\NuGet.targets = .nuget\NuGet.targets 18 | EndProjectSection 19 | EndProject 20 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{81E951C4-556A-4369-B942-ADF9138A0E06}" 21 | EndProject 22 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.Tests", "Facebook.Tests\Facebook.Tests.csproj", "{C08F42B4-6FF6-488E-90D6-8A47387BCDE3}" 23 | EndProject 24 | Global 25 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 26 | Debug|Any CPU = Debug|Any CPU 27 | Release|Any CPU = Release|Any CPU 28 | EndGlobalSection 29 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 30 | {857E540C-0092-4590-A279-F98A6B77AC0A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 31 | {857E540C-0092-4590-A279-F98A6B77AC0A}.Debug|Any CPU.Build.0 = Debug|Any CPU 32 | {857E540C-0092-4590-A279-F98A6B77AC0A}.Release|Any CPU.ActiveCfg = Release|Any CPU 33 | {857E540C-0092-4590-A279-F98A6B77AC0A}.Release|Any CPU.Build.0 = Release|Any CPU 34 | {C08F42B4-6FF6-488E-90D6-8A47387BCDE3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 35 | {C08F42B4-6FF6-488E-90D6-8A47387BCDE3}.Debug|Any CPU.Build.0 = Debug|Any CPU 36 | {C08F42B4-6FF6-488E-90D6-8A47387BCDE3}.Release|Any CPU.ActiveCfg = Release|Any CPU 37 | {C08F42B4-6FF6-488E-90D6-8A47387BCDE3}.Release|Any CPU.Build.0 = Release|Any CPU 38 | EndGlobalSection 39 | GlobalSection(SolutionProperties) = preSolution 40 | HideSolutionNode = FALSE 41 | EndGlobalSection 42 | GlobalSection(NestedProjects) = preSolution 43 | {C08F42B4-6FF6-488E-90D6-8A47387BCDE3} = {81E951C4-556A-4369-B942-ADF9138A0E06} 44 | EndGlobalSection 45 | EndGlobal 46 | -------------------------------------------------------------------------------- /Source/Facebook.Tests/FacebookClient/ExtractMediaObject/GivenOneMediaObjectThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | using System.Collections.Generic; 21 | using Xunit; 22 | 23 | namespace Facebook.Tests.FacebookClient.ExtractMediaObject 24 | { 25 | public class GivenOneMediaObjectThen 26 | { 27 | private IDictionary _parameters; 28 | 29 | public GivenOneMediaObjectThen() 30 | { 31 | _parameters = new Dictionary(); 32 | _parameters["source"] = new FacebookMediaObject(); 33 | _parameters["message"] = "hello world"; 34 | } 35 | 36 | [Fact] 37 | public void ResultIsNotNull() 38 | { 39 | var result = Facebook.FacebookClient.ExtractMediaObjects(_parameters); 40 | 41 | Assert.NotNull(result); 42 | } 43 | 44 | [Fact] 45 | public void ResultCountIs1() 46 | { 47 | var result = Facebook.FacebookClient.ExtractMediaObjects(_parameters); 48 | 49 | Assert.Equal(1, result.Count); 50 | } 51 | 52 | [Fact] 53 | public void ParametersCountIs1() 54 | { 55 | var result = Facebook.FacebookClient.ExtractMediaObjects(_parameters); 56 | 57 | Assert.Equal(1, _parameters.Count); 58 | } 59 | } 60 | } -------------------------------------------------------------------------------- /Source/Facebook.Tests/FacebookUtils/ParseUrlQueryString/GivenAValidQuerystringThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.FacebookUtils.ParseUrlQueryString 21 | { 22 | using System.Collections.Generic; 23 | using Facebook; 24 | using Xunit; 25 | using Xunit.Extensions; 26 | 27 | public class GivenAValidQuerystringThen 28 | { 29 | [PropertyData("ValidQueryStrings")] 30 | [Theory] 31 | public void TheCountOfResultShouldBeNumberOfQuerystringKeys(string queryString, int total) 32 | { 33 | var result = FacebookUtils.ParseUrlQueryString(queryString); 34 | 35 | Assert.Equal(total, result.Count); 36 | } 37 | 38 | public static IEnumerable ValidQueryStrings 39 | { 40 | get 41 | { 42 | yield return new object[] { "access_token=124973200873702%7C2.16KX_wTFlY2IAvWucsCKWA__.3600.1294927200-100001327642026%7CERLPsyFd8CP4ZI57VzAn0nl6WXo&expires_in=3699", 2 }; 43 | yield return new object[] { "type=user_agent&client_id=123&redirect_uri=http://www.facebook.com/connect/login_success.html&display=popup", 4 }; 44 | yield return new object[] { "error_reason=user_denied&error=access_denied&error_description=The+user+denied+your+request.", 3 }; 45 | } 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /Source/Facebook.Tests/FacebookClient/ExtractMediaObject/GivenMoreThanOneMediaObjectsOnlyThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | using System.Collections.Generic; 21 | using Xunit; 22 | 23 | namespace Facebook.Tests.FacebookClient.ExtractMediaObject 24 | { 25 | public class GivenMoreThanOneMediaObjectsOnlyThen 26 | { 27 | private IDictionary _parameters; 28 | 29 | public GivenMoreThanOneMediaObjectsOnlyThen() 30 | { 31 | _parameters = new Dictionary(); 32 | _parameters["file1"] = new FacebookMediaObject(); 33 | _parameters["file2"] = new FacebookMediaObject(); 34 | } 35 | 36 | [Fact] 37 | public void ResultIsNotNull() 38 | { 39 | var result = Facebook.FacebookClient.ExtractMediaObjects(_parameters); 40 | 41 | Assert.NotNull(result); 42 | } 43 | 44 | [Fact] 45 | public void ResultCountIs1() 46 | { 47 | var result = Facebook.FacebookClient.ExtractMediaObjects(_parameters); 48 | 49 | Assert.Equal(2, result.Count); 50 | } 51 | 52 | [Fact] 53 | public void ParametersCountIs1() 54 | { 55 | var result = Facebook.FacebookClient.ExtractMediaObjects(_parameters); 56 | 57 | Assert.Equal(0, _parameters.Count); 58 | } 59 | } 60 | } -------------------------------------------------------------------------------- /Source/Facebook.Tests/FacebookUtils/ConvertToString/GivenAHttpMethodEnumThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.FacebookUtils.ConvertToString 21 | { 22 | using Facebook; 23 | using Xunit; 24 | using Xunit.Extensions; 25 | 26 | public class GivenAHttpMethodEnumThen 27 | { 28 | #if SILVERLIGHT 29 | [InlineData(HttpMethod.Get, "GET")] 30 | [InlineData(HttpMethod.Post, "POST")] 31 | [Theory] 32 | public void ItShouldReturnTheEquivalentString(HttpMethod httpMethod, string strHttpMethod) 33 | { 34 | var result = FacebookUtils.ConvertToString(httpMethod); 35 | 36 | Assert.Equal(strHttpMethod, result); 37 | } 38 | 39 | [Fact] 40 | public void DeleteShouldReturnPost() 41 | { 42 | var result = FacebookUtils.ConvertToString(HttpMethod.Delete); 43 | Assert.Equal("POST", result); 44 | } 45 | #else 46 | [InlineData(HttpMethod.Get, "GET")] 47 | [InlineData(HttpMethod.Post, "POST")] 48 | [InlineData(HttpMethod.Delete, "DELETE")] 49 | [Theory] 50 | public void ItShouldReturnTheEquivalentString(HttpMethod httpMethod, string strHttpMethod) 51 | { 52 | var result = FacebookUtils.ConvertToString(httpMethod); 53 | 54 | Assert.Equal(strHttpMethod, result); 55 | } 56 | #endif 57 | } 58 | } -------------------------------------------------------------------------------- /Source/Facebook-Net40.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2012 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook-Net40", "Facebook\Facebook-Net40.csproj", "{857E540C-0092-4590-A279-F98A6B77AC0A}" 5 | EndProject 6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{66AEDC56-5AFC-4DDB-8616-4B21A486B12D}" 7 | ProjectSection(SolutionItems) = preProject 8 | ..\CHANGES.txt = ..\CHANGES.txt 9 | ..\jakefile.js = ..\jakefile.js 10 | ..\README.md = ..\README.md 11 | ..\VERSION = ..\VERSION 12 | EndProjectSection 13 | EndProject 14 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{D65B043E-4AA2-46F0-A4D2-0A3C345D3534}" 15 | ProjectSection(SolutionItems) = preProject 16 | .nuget\NuGet.exe = .nuget\NuGet.exe 17 | .nuget\NuGet.targets = .nuget\NuGet.targets 18 | .nuget\packages.config = .nuget\packages.config 19 | EndProjectSection 20 | EndProject 21 | Global 22 | GlobalSection(TestCaseManagementSettings) = postSolution 23 | CategoryFile = Facebook.vsmdi 24 | EndGlobalSection 25 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 26 | Debug|Any CPU = Debug|Any CPU 27 | Debug|Mixed Platforms = Debug|Mixed Platforms 28 | Debug|x86 = Debug|x86 29 | Release|Any CPU = Release|Any CPU 30 | Release|Mixed Platforms = Release|Mixed Platforms 31 | Release|x86 = Release|x86 32 | EndGlobalSection 33 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 34 | {857E540C-0092-4590-A279-F98A6B77AC0A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 35 | {857E540C-0092-4590-A279-F98A6B77AC0A}.Debug|Any CPU.Build.0 = Debug|Any CPU 36 | {857E540C-0092-4590-A279-F98A6B77AC0A}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU 37 | {857E540C-0092-4590-A279-F98A6B77AC0A}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU 38 | {857E540C-0092-4590-A279-F98A6B77AC0A}.Debug|x86.ActiveCfg = Debug|Any CPU 39 | {857E540C-0092-4590-A279-F98A6B77AC0A}.Release|Any CPU.ActiveCfg = Release|Any CPU 40 | {857E540C-0092-4590-A279-F98A6B77AC0A}.Release|Any CPU.Build.0 = Release|Any CPU 41 | {857E540C-0092-4590-A279-F98A6B77AC0A}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU 42 | {857E540C-0092-4590-A279-F98A6B77AC0A}.Release|Mixed Platforms.Build.0 = Release|Any CPU 43 | {857E540C-0092-4590-A279-F98A6B77AC0A}.Release|x86.ActiveCfg = Release|Any CPU 44 | EndGlobalSection 45 | GlobalSection(SolutionProperties) = preSolution 46 | HideSolutionNode = FALSE 47 | EndGlobalSection 48 | EndGlobal 49 | -------------------------------------------------------------------------------- /Source/Facebook.Tests/FacebookUtils/ConvertToString/GivenANumberInEnumRangeThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.FacebookUtils.ConvertToString 21 | { 22 | using Facebook; 23 | using Xunit; 24 | using Xunit.Extensions; 25 | 26 | public class GivenANumberInEnumRangeThen 27 | { 28 | #if SILVERLIGHT 29 | [InlineData(0, "GET")] 30 | [InlineData(1, "POST")] 31 | [Theory] 32 | public void ItShouldReturnTheEquivalentString(int number, string strHttpMethod) 33 | { 34 | var httpMethod = (HttpMethod)number; 35 | 36 | var result = FacebookUtils.ConvertToString(httpMethod); 37 | 38 | Assert.Equal(strHttpMethod, result); 39 | } 40 | 41 | [Fact] 42 | public void TwoShouldReturnPost() 43 | { 44 | var result = FacebookUtils.ConvertToString((HttpMethod)2); 45 | 46 | Assert.Equal("POST", result); 47 | } 48 | #else 49 | [InlineData(0, "GET")] 50 | [InlineData(1, "POST")] 51 | [InlineData(2, "DELETE")] 52 | [Theory] 53 | public void ItShouldReturnTheEquivalentString(int number, string strHttpMethod) 54 | { 55 | var httpMethod = (HttpMethod)number; 56 | 57 | var result = FacebookUtils.ConvertToString(httpMethod); 58 | 59 | Assert.Equal(strHttpMethod, result); 60 | } 61 | #endif 62 | } 63 | } -------------------------------------------------------------------------------- /Source/Facebook.Tests/FacebookUtils/ParseQueryParametersToDictionary/GivenAPathStartingWithForwardSlashWithQuerystringAndEmptyParametersThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.FacebookUtils.ParseQueryParametersToDictionary 21 | { 22 | using System.Collections.Generic; 23 | using Facebook; 24 | using Xunit; 25 | 26 | public class GivenAPathStartingWithForwardSlashWithQuerystringAndEmptyParametersThen 27 | { 28 | [Fact] 29 | public void ReturnPathEqualsThePathWithoutForwardSlashAndQuerystring() 30 | { 31 | string originalPathWithQueryString = "/me/likes?limit=3&offset=2"; 32 | string pathWithoutForwardSlashAndQueryString = "me/likes"; 33 | var parameters = new Dictionary(); 34 | 35 | var path = FacebookUtils.ParseQueryParametersToDictionary(originalPathWithQueryString, parameters); 36 | 37 | Assert.Equal(pathWithoutForwardSlashAndQueryString, path); 38 | } 39 | 40 | [Fact] 41 | public void ReturnPathDoesNotStartWithForwardSlash() 42 | { 43 | string originalPathWithQueryString = "/me/likes?limit=3&offset=2"; 44 | var parameters = new Dictionary(); 45 | 46 | var path = FacebookUtils.ParseQueryParametersToDictionary(originalPathWithQueryString, parameters); 47 | 48 | Assert.NotEqual('/', path[0]); 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /Source/Facebook.Tests/FacebookUtils/ToJsonQueryString/WhenObjectDictionaryHasValuesThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.FacebookUtils.ToJsonQueryString 21 | { 22 | using System.Collections.Generic; 23 | using Facebook; 24 | using Xunit; 25 | 26 | public class WhenObjectDictionaryHasValuesThen 27 | { 28 | [Fact] 29 | public void ResultShouldNotBeEmptyStringOrNull() 30 | { 31 | var dict = new Dictionary 32 | { 33 | {"key1", "value1"}, 34 | {"key2", "value2"} 35 | }; 36 | 37 | var result = FacebookUtils.ToJsonQueryString(dict); 38 | 39 | Assert.False(string.IsNullOrEmpty(result)); 40 | } 41 | 42 | [Fact] 43 | public void ResultShouldBeQuerystringFormatted() 44 | { 45 | var dict = new Dictionary 46 | { 47 | {"key1", "value1"}, 48 | {"key2", "value2"} 49 | }; 50 | var exepected = "key1=value1&key2=value2"; 51 | 52 | var result = FacebookUtils.ToJsonQueryString(dict); 53 | 54 | // TODO: check key and values that needs to be encoded too 55 | Assert.Equal(exepected, result); 56 | } 57 | } 58 | } -------------------------------------------------------------------------------- /Source/Facebook.Tests/FacebookUtils/ToJsonQueryString/WhenStringDictionaryHasValuesThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.FacebookUtils.ToJsonQueryString 21 | { 22 | using System.Collections.Generic; 23 | using Facebook; 24 | using Xunit; 25 | 26 | public class WhenStringDictionaryHasValuesThen 27 | { 28 | [Fact] 29 | public void ResultShouldNotBeEmptyStringOrNull() 30 | { 31 | var dict = new Dictionary 32 | { 33 | {"key1", "value1"}, 34 | {"key2", "value2"} 35 | }; 36 | 37 | var result = FacebookUtils.ToJsonQueryString(dict); 38 | 39 | Assert.False(string.IsNullOrEmpty(result)); 40 | } 41 | 42 | [Fact] 43 | public void ResultShouldBeQuerstringFormatted() 44 | { 45 | var dict = new Dictionary 46 | { 47 | {"key1", "value1"}, 48 | {"key2", "value2"} 49 | }; 50 | var exepected = "key1=value1&key2=value2"; 51 | 52 | var result = FacebookUtils.ToJsonQueryString(dict); 53 | 54 | // TODO: check key and values that needs to be encoded too 55 | Assert.Equal(exepected, result); 56 | } 57 | } 58 | } -------------------------------------------------------------------------------- /Source/Facebook.Tests/ExceptionFactory/GetRestException/GivenAnDictionaryStringObjectWithErrorCodeNotEqualTo190Or4WithMessageRequestLimitReachedThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.ExceptionFactory.GetRestException 21 | { 22 | using System.Collections.Generic; 23 | using Facebook; 24 | using Xunit; 25 | 26 | public class GivenAnDictionaryStringObjectWithErrorCodeNotEqualTo190Or4WithMessageRequestLimitReachedThen 27 | { 28 | private IDictionary dict; 29 | 30 | public GivenAnDictionaryStringObjectWithErrorCodeNotEqualTo190Or4WithMessageRequestLimitReachedThen() 31 | { 32 | int errorCodeNot190or4 = 10000; 33 | dict = new Dictionary 34 | { 35 | { "error_code", errorCodeNot190or4 }, 36 | { "error_msg", "request limit reached"} 37 | // others ommited for brevity 38 | }; 39 | } 40 | 41 | [Fact] 42 | public void ResultIsNotNull() 43 | { 44 | var result = ExceptionFactory.GetRestException(dict); 45 | 46 | Assert.NotNull(result); 47 | } 48 | 49 | [Fact] 50 | public void ResultIsOfTypeFacebookApiLimitException() 51 | { 52 | var result = ExceptionFactory.GetRestException(dict); 53 | 54 | Assert.IsType(result); 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /Source/Facebook/FacebookMediaObject.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook 21 | { 22 | /// 23 | /// Represents a media object such as a photo or video. 24 | /// 25 | public class FacebookMediaObject 26 | { 27 | /// 28 | /// The value of the media object. 29 | /// 30 | private byte[] _value; 31 | 32 | /// 33 | /// Gets or sets the type of the content. 34 | /// 35 | /// The type of the content. 36 | public string ContentType { get; set; } 37 | 38 | /// 39 | /// Gets or sets the name of the file. 40 | /// 41 | /// The name of the file. 42 | public string FileName { get; set; } 43 | 44 | /// 45 | /// Sets the value of the media object. 46 | /// 47 | /// The media object value. 48 | /// Facebook Media Object 49 | public FacebookMediaObject SetValue(byte[] value) 50 | { 51 | _value = value; 52 | return this; 53 | } 54 | 55 | /// 56 | /// Gets the value of the media object. 57 | /// 58 | /// The value of the media object. 59 | public byte[] GetValue() 60 | { 61 | return _value; 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /Source/Facebook.Tests/ExceptionFactory/GetRestException/GivenADictionaryOfStringObjectThatContainsErrorCodeOnlyThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.ExceptionFactory.GetRestException 21 | { 22 | using System.Collections.Generic; 23 | using Facebook; 24 | using Xunit; 25 | 26 | public class GivenADictionaryOfStringObjectThatContainsErrorCodeOnlyThen 27 | { 28 | private IDictionary dict; 29 | private int errorCode; 30 | 31 | public GivenADictionaryOfStringObjectThatContainsErrorCodeOnlyThen() 32 | { 33 | errorCode = 100; 34 | dict = new Dictionary 35 | { 36 | {"error_code", errorCode} 37 | }; 38 | } 39 | 40 | [Fact] 41 | public void ResultIsNotNull() 42 | { 43 | var result = ExceptionFactory.GetRestException(dict); 44 | 45 | Assert.NotNull(result); 46 | } 47 | 48 | [Fact] 49 | public void ResultIsOfTypeFacebookApiException() 50 | { 51 | var result = ExceptionFactory.GetRestException(dict); 52 | 53 | Assert.IsType(result); 54 | } 55 | 56 | [Fact] 57 | public void ErrorTypeIsEqualToErrorCode() 58 | { 59 | var result = ExceptionFactory.GetRestException(dict); 60 | 61 | Assert.Equal(errorCode.ToString(), result.ErrorType); 62 | } 63 | } 64 | } -------------------------------------------------------------------------------- /Source/Facebook.Tests/ExceptionFactory/GetRestException/GivenADictionaryOfStringObjectWithErrorCode4Then.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | namespace Facebook.Tests.ExceptionFactory.GetRestException 20 | { 21 | using System.Collections.Generic; 22 | using Facebook; 23 | using Xunit; 24 | 25 | public class GivenADictionaryOfStringObjectWithErrorCode4Then 26 | { 27 | private IDictionary dict; 28 | private int errorCode; 29 | 30 | public GivenADictionaryOfStringObjectWithErrorCode4Then() 31 | { 32 | errorCode = 4; 33 | dict = new Dictionary 34 | { 35 | { "error_code", errorCode } 36 | // others ommited for brevity 37 | }; 38 | } 39 | 40 | [Fact] 41 | public void ResultIsNotNull() 42 | { 43 | var result = ExceptionFactory.GetRestException(dict); 44 | 45 | Assert.NotNull(result); 46 | } 47 | 48 | [Fact] 49 | public void ResultIsOfTypeFacebookApiLimitException() 50 | { 51 | var result = ExceptionFactory.GetRestException(dict); 52 | 53 | Assert.IsType(result); 54 | } 55 | 56 | [Fact] 57 | public void ErrorTypeIs4() 58 | { 59 | var result = ExceptionFactory.GetRestException(dict); 60 | 61 | Assert.Equal("4", result.ErrorType); 62 | } 63 | } 64 | } -------------------------------------------------------------------------------- /Source/Facebook.Tests/ExceptionFactory/GetRestException/GivenADictionaryOfStringObjectWithErrorCode190Then.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.ExceptionFactory.GetRestException 21 | { 22 | using System.Collections.Generic; 23 | using Facebook; 24 | using Xunit; 25 | 26 | public class GivenADictionaryOfStringObjectWithErrorCode190Then 27 | { 28 | private IDictionary dict; 29 | private int errorCode; 30 | 31 | public GivenADictionaryOfStringObjectWithErrorCode190Then() 32 | { 33 | errorCode = 190; 34 | dict = new Dictionary 35 | { 36 | { "error_code", errorCode } 37 | // others ommited for brevity 38 | }; 39 | } 40 | 41 | [Fact] 42 | public void ResultIsNotNull() 43 | { 44 | var result = ExceptionFactory.GetRestException(dict); 45 | 46 | Assert.NotNull(result); 47 | } 48 | 49 | [Fact] 50 | public void ResultIsOfTypeFacebookOAuthException() 51 | { 52 | var result = ExceptionFactory.GetRestException(dict); 53 | 54 | Assert.IsType(result); 55 | } 56 | 57 | [Fact] 58 | public void ErrorTypeIs190() 59 | { 60 | var result = ExceptionFactory.GetRestException(dict); 61 | 62 | Assert.Equal("190", result.ErrorType); 63 | } 64 | } 65 | } -------------------------------------------------------------------------------- /Tools/xunitcontrib-silverlight.0.2/EULA.txt: -------------------------------------------------------------------------------- 1 | This license governs use of the accompanying software. If you use the software, you accept this license. If you do not accept the license, do not use the software. 2 | 3 | 1. Definitions 4 | 5 | The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning here as under U.S. copyright law. 6 | 7 | A "contribution" is the original software, or any additions or changes to the software. 8 | 9 | A "contributor" is any person that distributes its contribution under this license. 10 | 11 | "Licensed patents" are a contributor's patent claims that read directly on its contribution. 12 | 13 | 2. Grant of Rights 14 | 15 | (A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create. 16 | 17 | (B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software. 18 | 19 | 3. Conditions and Limitations 20 | 21 | (A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks. 22 | 23 | (B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically. 24 | 25 | (C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software. 26 | 27 | (D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license. 28 | 29 | (E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement. -------------------------------------------------------------------------------- /Source/Facebook.Tests/ExceptionFactory/GetRestException/GivenADictionaryOfStringObjectWithErrorCodeAsApiEcTooManyCallsThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.ExceptionFactory.GetRestException 21 | { 22 | using System.Collections.Generic; 23 | using Facebook; 24 | using Xunit; 25 | 26 | public class GivenADictionaryOfStringObjectWithErrorCodeAsApiEcTooManyCallsThen 27 | { 28 | private IDictionary dict; 29 | private string errorCode; 30 | 31 | public GivenADictionaryOfStringObjectWithErrorCodeAsApiEcTooManyCallsThen() 32 | { 33 | errorCode = "API_EC_TOO_MANY_CALLS"; 34 | dict = new Dictionary 35 | { 36 | { "error_code", errorCode } 37 | // others ommited for brevity 38 | }; 39 | } 40 | 41 | [Fact] 42 | public void ResultIsNotNull() 43 | { 44 | var result = ExceptionFactory.GetRestException(dict); 45 | 46 | Assert.NotNull(result); 47 | } 48 | 49 | [Fact] 50 | public void ResultIsOfTypeFacebookApiLimitException() 51 | { 52 | var result = ExceptionFactory.GetRestException(dict); 53 | 54 | Assert.IsType(result); 55 | } 56 | 57 | [Fact] 58 | public void ErrorTypeIsApiEcTooManyCalls() 59 | { 60 | var result = ExceptionFactory.GetRestException(dict); 61 | 62 | Assert.Equal(errorCode, result.ErrorType); 63 | } 64 | } 65 | } -------------------------------------------------------------------------------- /Source/Facebook.Tests/FacebookUtils/ParseQueryParametersToDictionary/GivenAPathWith2QuerystringsAndEmptyParametersThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | // Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) 17 | // https://github.com/facebook-csharp-sdk/facbook-csharp-sdk 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.FacebookUtils.ParseQueryParametersToDictionary 21 | { 22 | using System.Collections.Generic; 23 | using Facebook; 24 | using Xunit; 25 | 26 | public class GivenAPathWith2QuerystringsAndEmptyParametersThen 27 | { 28 | [Fact] 29 | public void ReturnPathEqualsThePathWithoutQuerystring() 30 | { 31 | string originalPath = "/me/likes?limit=3&offset=2"; 32 | var parameters = new Dictionary(); 33 | 34 | var path = FacebookUtils.ParseQueryParametersToDictionary(originalPath, parameters); 35 | 36 | Assert.Equal(path, "me/likes"); 37 | } 38 | 39 | [Fact] 40 | public void ParameterValuesEqualToTheQuerystrings() 41 | { 42 | string path = "/me/likes?limit=3&offset=2"; 43 | var parameters = new Dictionary(); 44 | 45 | FacebookUtils.ParseQueryParametersToDictionary(path, parameters); 46 | 47 | Assert.Equal("3", parameters["limit"]); 48 | Assert.Equal("2", parameters["offset"]); 49 | } 50 | 51 | [Fact] 52 | public void CountOfParametersEquals2() 53 | { 54 | string path = "/me/likes?limit=3&offset=2"; 55 | var parameters = new Dictionary(); 56 | 57 | FacebookUtils.ParseQueryParametersToDictionary(path, parameters); 58 | 59 | Assert.Equal(2, parameters.Count); 60 | } 61 | } 62 | } -------------------------------------------------------------------------------- /Build/NuGet/Facebook/Facebook.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Facebook 5 | $version$ 6 | 7 | <authors>Outercurve Foundation</authors> 8 | <owners>Sanjeev Dwivedi, Prabir Shrestha</owners> 9 | <description>The Facebook SDK for .NET helps developers build web, desktop, phone and Windows Store applications that integrate with Facebook.</description> 10 | <language>en-US</language> 11 | <licenseUrl>https://raw.github.com/facebook-csharp-sdk/facebook-csharp-sdk/master/LICENSE.txt</licenseUrl> 12 | <projectUrl>https://github.com/facebook-csharp-sdk/facebook-csharp-sdk</projectUrl> 13 | <iconUrl>http://facebooksdk.net/assets/img/logo75x75.png</iconUrl> 14 | <requireLicenseAcceptance>false</requireLicenseAcceptance> 15 | <tags>Facebook fb</tags> 16 | </metadata> 17 | <files> 18 | <file src="..\..\..\LICENSE.txt" target = "LICENSE.txt" /> 19 | <file src="..\..\..\Build\readme.txt" target = "readme.txt" /> 20 | <file src="..\..\..\Build\NuGet\Facebook\serializers\*" target = "serializers" /> 21 | <file src="..\..\..\Bin\Release\net45\*.dll" target = "lib\net45" /> 22 | <file src="..\..\..\Bin\Release\net45\*.xml" target = "lib\net45" /> 23 | <file src="..\..\..\Bin\Release\win8\*.dll" target = "lib\win8" /> 24 | <file src="..\..\..\Bin\Release\win8\*.xml" target = "lib\win8" /> 25 | <file src="..\..\..\Bin\Release\net40-client\*.dll" target = "lib\net40-client" /> 26 | <file src="..\..\..\Bin\Release\net40-client\*.xml" target = "lib\net40-client" /> 27 | <file src="..\..\..\Bin\Release\net35-client\*.dll" target = "lib\net35-client" /> 28 | <file src="..\..\..\Bin\Release\net35-client\*.xml" target = "lib\net35-client" /> 29 | <file src="..\..\..\Bin\Release\sl5\*.dll" target = "lib\sl5" /> 30 | <file src="..\..\..\Bin\Release\sl5\*.xml" target = "lib\sl5" /> 31 | <file src="..\..\..\Bin\Release\wp71\*.dll" target = "lib\wp71" /> 32 | <file src="..\..\..\Bin\Release\wp71\*.xml" target = "lib\wp71" /> 33 | <file src="..\..\..\Bin\Release\wp8\*.dll" target = "lib\wp8" /> 34 | <file src="..\..\..\Bin\Release\wp8\*.xml" target = "lib\wp8" /> 35 | <file src="..\..\..\Bin\Release\wp81sl\*.dll" target = "lib\wp81" /> 36 | <file src="..\..\..\Bin\Release\wp81sl\*.xml" target = "lib\wp81" /> 37 | <file src="..\..\..\Bin\Release\win81universal\*.dll" target = "lib\portable-win81+wpa81" /> 38 | <file src="..\..\..\Bin\Release\win81universal\*.xml" target = "lib\portable-win81+wpa81" /> 39 | </files> 40 | </package> 41 | -------------------------------------------------------------------------------- /Source/Facebook.Tests/FacebookUtils/Merge/WhenBothTheCombinationOfFirstInputAndSecondInputContainsUniqueKeysThen.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // <copyright file="<file>.cs" company="The Outercurve Foundation"> 3 | // Copyright (c) 2011, The Outercurve Foundation. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // </copyright> 16 | // <author>Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me)</author> 17 | // <website>https://github.com/facebook-csharp-sdk/facbook-csharp-sdk</website> 18 | //----------------------------------------------------------------------- 19 | 20 | namespace Facebook.Tests.FacebookUtils.Merge 21 | { 22 | using System.Collections.Generic; 23 | using Facebook; 24 | using Xunit; 25 | 26 | public class WhenBothTheCombinationOfFirstInputAndSecondInputContainsUniqueKeysThen 27 | { 28 | [Fact] 29 | public void ResultShouldNotBeNull() 30 | { 31 | var first = new Dictionary<string, object> { { "prop1", "value1" } }; 32 | var second = new Dictionary<string, object> { { "prop2", "value2" } }; 33 | 34 | var result = FacebookUtils.Merge(first, second); 35 | 36 | Assert.NotNull(result); 37 | } 38 | 39 | [Fact] 40 | public void TheCountOfResultShouldBeEqualToCountOfFirstAndSecondInputs() 41 | { 42 | var first = new Dictionary<string, object> { { "prop1", "value1" } }; 43 | var second = new Dictionary<string, object> { { "prop2", "value2" } }; 44 | 45 | var result = FacebookUtils.Merge(first, second); 46 | 47 | Assert.Equal(2, result.Count); 48 | } 49 | 50 | [Fact] 51 | public void TheValuesShouldBeEqualToTheOneInsertedFromFirstOrSecond() 52 | { 53 | var first = new Dictionary<string, object> { { "prop1", "value1" } }; 54 | var second = new Dictionary<string, object> { { "prop2", "value2" } }; 55 | 56 | var result = FacebookUtils.Merge(first, second); 57 | 58 | Assert.Equal(first["prop1"], result["prop1"]); 59 | Assert.Equal(second["prop2"], result["prop2"]); 60 | } 61 | } 62 | } --------------------------------------------------------------------------------