Initial commit of Usergrid .NET SDK into its own rep

Project: http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/repo
Commit: http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/commit/94c0483c
Tree: http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/tree/94c0483c
Diff: http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/diff/94c0483c

Branch: refs/heads/master
Commit: 94c0483ccbb3107902f05b3fcc2be298d361ace3
Parents: 
Author: Michael Russo <mru...@apigee.com>
Authored: Fri Sep 2 10:06:01 2016 -0700
Committer: Michael Russo <mru...@apigee.com>
Committed: Fri Sep 2 10:06:01 2016 -0700

----------------------------------------------------------------------
 .gitattributes                                  |  22 +
 .gitignore                                      | 152 +++++++
 LICENSE                                         | 202 +++++++++
 NOTICE                                          |  56 +++
 README.md                                       | 316 +++++++++++++
 .../ActivitiesTests.cs                          | 174 ++++++++
 Usergrid.Sdk.IntegrationTests/BaseTest.cs       | 163 +++++++
 .../ConnectionTests.cs                          | 199 +++++++++
 Usergrid.Sdk.IntegrationTests/DeviceTests.cs    |  63 +++
 .../EntityCrudTests.cs                          | 153 +++++++
 .../EntityPagingTests.cs                        |  83 ++++
 Usergrid.Sdk.IntegrationTests/Friend.cs         |  23 +
 Usergrid.Sdk.IntegrationTests/GroupTests.cs     |  91 ++++
 Usergrid.Sdk.IntegrationTests/LoginTests.cs     |  96 ++++
 .../NotificationTests.cs                        | 133 ++++++
 .../Properties/AssemblyInfo.cs                  |  55 +++
 .../UserManagementTests.cs                      |  96 ++++
 .../Usergrid.Sdk.IntegrationTests.csproj        | 109 +++++
 .../Usergrid.Sdk.IntegrationTests.dll.config    |  33 ++
 Usergrid.Sdk.IntegrationTests/UsergridFriend.cs |  23 +
 Usergrid.Sdk.IntegrationTests/packages.config   |  24 +
 .../AuthenticationManagerTests.cs               | 135 ++++++
 Usergrid.Sdk.Tests/ClientTests/ActivityTests.cs |  86 ++++
 .../ClientTests/ConnectionTests.cs              |  88 ++++
 Usergrid.Sdk.Tests/ClientTests/DeviceTests.cs   | 143 ++++++
 Usergrid.Sdk.Tests/ClientTests/EntityTests.cs   | 210 +++++++++
 Usergrid.Sdk.Tests/ClientTests/FeedTests.cs     |  65 +++
 Usergrid.Sdk.Tests/ClientTests/GroupTests.cs    | 199 +++++++++
 Usergrid.Sdk.Tests/ClientTests/LoginTests.cs    |  67 +++
 .../ClientTests/NotificationTests.cs            | 149 +++++++
 Usergrid.Sdk.Tests/ClientTests/UserTests.cs     | 153 +++++++
 Usergrid.Sdk.Tests/ConnectionManagerTests.cs    | 240 ++++++++++
 Usergrid.Sdk.Tests/EntityManagerTests.cs        | 440 +++++++++++++++++++
 Usergrid.Sdk.Tests/Friend.cs                    |  35 ++
 Usergrid.Sdk.Tests/Helpers.cs                   |  94 ++++
 .../Model/NotificationRecipientsTests.cs        | 147 +++++++
 Usergrid.Sdk.Tests/Model/NotificationTests.cs   |  55 +++
 Usergrid.Sdk.Tests/NotificationsManagerTests.cs | 118 +++++
 Usergrid.Sdk.Tests/Properties/AssemblyInfo.cs   |  57 +++
 Usergrid.Sdk.Tests/Usergrid.Sdk.Tests.csproj    | 110 +++++
 Usergrid.Sdk.Tests/UsergridRequestTests.cs      | 140 ++++++
 Usergrid.Sdk.Tests/packages.config              |  24 +
 Usergrid.Sdk/Client.cs                          | 262 +++++++++++
 Usergrid.Sdk/IClient.cs                         |  73 +++
 Usergrid.Sdk/IUsergridRequest.cs                |  28 ++
 Usergrid.Sdk/Manager/AuthenticationManager.cs   |  74 ++++
 Usergrid.Sdk/Manager/ConnectionManager.cs       |  99 +++++
 Usergrid.Sdk/Manager/EntityManager.cs           | 177 ++++++++
 Usergrid.Sdk/Manager/IAuthenticationManager.cs  |  25 ++
 Usergrid.Sdk/Manager/IConnectionManager.cs      |  26 ++
 Usergrid.Sdk/Manager/IEntityManager.cs          |  30 ++
 Usergrid.Sdk/Manager/INotificationsManager.cs   |  27 ++
 Usergrid.Sdk/Manager/ManagerBase.cs             |  42 ++
 Usergrid.Sdk/Manager/NotificationsManager.cs    |  77 ++++
 Usergrid.Sdk/Model/AndroidNotification.cs       |  37 ++
 Usergrid.Sdk/Model/AppleNotification.cs         |  49 +++
 Usergrid.Sdk/Model/AuthType.cs                  |  25 ++
 Usergrid.Sdk/Model/Connection.cs                |  24 +
 Usergrid.Sdk/Model/INotificationRecipients.cs   |  32 ++
 Usergrid.Sdk/Model/Notification.cs              |  31 ++
 Usergrid.Sdk/Model/NotificationRecipients.cs    | 137 ++++++
 .../Model/NotificationSchedulerSettings.cs      |  35 ++
 Usergrid.Sdk/Model/UnixDateTimeHelper.cs        |  53 +++
 Usergrid.Sdk/Model/UserGridEntity.cs            |  45 ++
 Usergrid.Sdk/Model/UsergridActivity.cs          |  50 +++
 Usergrid.Sdk/Model/UsergridActor.cs             |  29 ++
 Usergrid.Sdk/Model/UsergridCollection.cs        |  30 ++
 Usergrid.Sdk/Model/UsergridDevice.cs            |  22 +
 Usergrid.Sdk/Model/UsergridEntitySerializer.cs  |  51 +++
 Usergrid.Sdk/Model/UsergridError.cs             |  31 ++
 Usergrid.Sdk/Model/UsergridException.cs         |  30 ++
 Usergrid.Sdk/Model/UsergridGroup.cs             |  24 +
 Usergrid.Sdk/Model/UsergridImage.cs             |  28 ++
 Usergrid.Sdk/Model/UsergridNotifier.cs          |  23 +
 Usergrid.Sdk/Model/UsergridUser.cs              |  27 ++
 Usergrid.Sdk/Payload/AndroidNotifierPayload.cs  |  29 ++
 .../Payload/CancelNotificationPayload.cs        |  25 ++
 Usergrid.Sdk/Payload/ChangePasswordPayload.cs   |  28 ++
 Usergrid.Sdk/Payload/ClientIdLoginPayload.cs    |  34 ++
 Usergrid.Sdk/Payload/LoginResponse.cs           |  25 ++
 Usergrid.Sdk/Payload/NotificationPayload.cs     |  38 ++
 Usergrid.Sdk/Payload/UserLoginPayload.cs        |  34 ++
 Usergrid.Sdk/Payload/UsergridGetResponse.cs     |  28 ++
 Usergrid.Sdk/Properties/AssemblyInfo.cs         |  51 +++
 Usergrid.Sdk/RestSharpJsonSerializer.cs         |  38 ++
 Usergrid.Sdk/Usergrid.Sdk.csproj                | 124 ++++++
 Usergrid.Sdk/UsergridRequest.cs                 |  91 ++++
 Usergrid.Sdk/packages.config                    |  22 +
 Usergrid.sln                                    |  49 +++
 new-project-template/new-project-template.sln   |  37 ++
 .../new-project-template/App.config             |  22 +
 .../new-project-template/Program.cs             |  91 ++++
 .../Properties/AssemblyInfo.cs                  |  51 +++
 .../new-project-template.csproj                 |  84 ++++
 packages/NSubstitute.1.6.0.0/LICENSE.txt        |  27 ++
 .../NSubstitute.1.6.0.0.nuspec                  |  19 +
 .../NSubstitute.1.6.0.0/acknowledgements.txt    |  63 +++
 packages/NUnit.2.6.2/NUnit.2.6.2.nuspec         |  31 ++
 packages/NUnit.2.6.2/license.txt                |  15 +
 packages/Newtonsoft.Json.4.5.11/LICENSE.txt     |  21 +
 .../Newtonsoft.Json.4.5.11.nuspec               |  19 +
 packages/RestSharp.104.1/LICENSE.txt            | 202 +++++++++
 packages/RestSharp.104.1/RestSharp.104.1.nuspec |  24 +
 packages/repositories.config                    |  22 +
 samples/README.md                               |   1 +
 samples/locationSample/LocationDotNetSample.sln |  36 ++
 .../LocationDotNetSample/App.config             |  22 +
 .../LocationDotNetSample/Form1.Designer.cs      | 269 ++++++++++++
 .../LocationDotNetSample/Form1.cs               | 148 +++++++
 .../LocationDotNetSample/Form1.resx             | 137 ++++++
 .../LocationDotNetSample.csproj                 | 129 ++++++
 .../LocationDotNetSample/Program.cs             |  37 ++
 .../Properties/AssemblyInfo.cs                  |  51 +++
 .../Properties/Resources.Designer.cs            |  86 ++++
 .../Properties/Resources.resx                   | 133 ++++++
 .../Properties/Settings.Designer.cs             |  45 ++
 .../Properties/Settings.settings                |  23 +
 .../LocationDotNetSample/Store.cs               |  45 ++
 .../LocationDotNetSample/packages.config        |  21 +
 samples/locationSample/ReadMe.md                |  20 +
 .../Geocoder.0.1.0.0/Geocoder.0.1.0.0.nupkg     | Bin 0 -> 5053 bytes
 .../Geocoder.0.1.0.0/Geocoder.0.1.0.0.nuspec    |  32 ++
 .../packages/Geocoder.0.1.0.0/README.txt        |   3 +
 .../Geocoder.0.1.0.0/lib/net45/Geocoder.dll     | Bin 0 -> 6144 bytes
 .../locationSample/packages/repositories.config |  20 +
 samples/locationSample/stores.json              |   1 +
 samples/loginAndCollectionSample/BooksApp.sln   |  36 ++
 .../BooksApp2/AddBook.Designer.vb               | 109 +++++
 .../BooksApp2/AddBook.resx                      | 136 ++++++
 .../BooksApp2/AddBook.vb                        |  33 ++
 .../BooksApp2/App.config                        |  23 +
 .../loginAndCollectionSample/BooksApp2/Book.vb  |  21 +
 .../BooksApp2/BooksApp.vbproj                   | 174 ++++++++
 .../BooksApp2/MainWindow.Designer.vb            | 147 +++++++
 .../BooksApp2/MainWindow.resx                   | 146 ++++++
 .../BooksApp2/MainWindow.vb                     |  70 +++
 .../My Project/Application.Designer.vb          |  53 +++
 .../BooksApp2/My Project/Application.myapp      |  27 ++
 .../BooksApp2/My Project/AssemblyInfo.vb        |  50 +++
 .../BooksApp2/My Project/Resources.Designer.vb  |  78 ++++
 .../BooksApp2/My Project/Resources.resx         | 134 ++++++
 .../BooksApp2/My Project/Settings.Designer.vb   |  88 ++++
 .../BooksApp2/My Project/Settings.settings      |  24 +
 .../BooksApp2/Settings.vb                       |  22 +
 .../BooksApp2/SettingsForm.Designer.vb          | 164 +++++++
 .../BooksApp2/SettingsForm.resx                 | 137 ++++++
 .../BooksApp2/SettingsForm.vb                   |  44 ++
 samples/loginAndCollectionSample/Readme.md      |  17 +
 samples/messageeTutorial/Messagee.sln           |  36 ++
 samples/messageeTutorial/Messagee/App.config    |  23 +
 samples/messageeTutorial/Messagee/Globals.vb    |  22 +
 .../Messagee/MainForm.Designer.vb               | 260 +++++++++++
 samples/messageeTutorial/Messagee/MainForm.resx | 143 ++++++
 samples/messageeTutorial/Messagee/MainForm.vb   |  97 ++++
 .../messageeTutorial/Messagee/Messagee.vbproj   | 173 ++++++++
 .../Messagee/My Project/Application.Designer.vb |  53 +++
 .../Messagee/My Project/Application.myapp       |  27 ++
 .../Messagee/My Project/AssemblyInfo.vb         |  50 +++
 .../Messagee/My Project/Resources.Designer.vb   |  77 ++++
 .../Messagee/My Project/Resources.resx          | 134 ++++++
 .../Messagee/My Project/Settings.Designer.vb    |  88 ++++
 .../Messagee/My Project/Settings.settings       |  24 +
 .../Messagee/Settings.Designer.vb               | 159 +++++++
 samples/messageeTutorial/Messagee/Settings.resx | 137 ++++++
 samples/messageeTutorial/Messagee/Settings.vb   |  28 ++
 .../Messagee/UserSettings.Designer.vb           | 191 ++++++++
 .../messageeTutorial/Messagee/UserSettings.resx | 137 ++++++
 .../messageeTutorial/Messagee/UserSettings.vb   |  96 ++++
 samples/messageeTutorial/Messagee/Utils.vb      |  82 ++++
 samples/messageeTutorial/README.md              |  15 +
 .../Usergrid.Notifications/App.xaml             |  27 ++
 .../Usergrid.Notifications/App.xaml.cs          | 150 +++++++
 .../Assets/Logo.scale-240.png                   | Bin 0 -> 2516 bytes
 .../Assets/SmallLogo.scale-240.png              | Bin 0 -> 753 bytes
 .../Assets/SplashScreen.scale-240.png           | Bin 0 -> 14715 bytes
 .../Assets/Square71x71Logo.scale-240.png        | Bin 0 -> 1122 bytes
 .../Assets/StoreLogo.scale-240.png              | Bin 0 -> 2200 bytes
 .../Assets/WideLogo.scale-240.png               | Bin 0 -> 4530 bytes
 .../Usergrid.Notifications/BackgroundTask.cs    |  57 +++
 .../Client/EntityResponse.cs                    |  80 ++++
 .../Client/IUsergridClient.cs                   | 123 ++++++
 .../Usergrid.Notifications/Client/PushClient.cs | 185 ++++++++
 .../Usergrid.Notifications/Client/Usergrid.cs   | 122 +++++
 .../Usergrid.Notifications/MainPage.xaml        |  39 ++
 .../Usergrid.Notifications/MainPage.xaml.cs     | 143 ++++++
 .../Usergrid.Notifications/MyBackgroundTask.cs  |  18 +
 .../Package.StoreAssociation.xml                | 194 ++++++++
 .../Usergrid.Notifications/Package.appxmanifest |  61 +++
 .../Properties/AssemblyInfo.cs                  |  29 ++
 .../Usergrid.Notifications.csproj               | 143 ++++++
 .../Usergrid.Notifications.sln                  |  40 ++
 .../Usergrid.Notifications/packages.config      |  25 ++
 .../notifications/packages/repositories.config  |   4 +
 193 files changed, 14602 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/.gitattributes
----------------------------------------------------------------------
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..412eeda
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,22 @@
+# Auto detect text files and perform LF normalization
+* text=auto
+
+# Custom for Visual Studio
+*.cs     diff=csharp
+*.sln    merge=union
+*.csproj merge=union
+*.vbproj merge=union
+*.fsproj merge=union
+*.dbproj merge=union
+
+# Standard to msysgit
+*.doc   diff=astextplain
+*.DOC   diff=astextplain
+*.docx diff=astextplain
+*.DOCX diff=astextplain
+*.dot  diff=astextplain
+*.DOT  diff=astextplain
+*.pdf  diff=astextplain
+*.PDF   diff=astextplain
+*.rtf   diff=astextplain
+*.RTF   diff=astextplain

http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..cad534a
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,152 @@
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+
+# User-specific files
+*.suo
+*.user
+*.sln.docstates
+MySettings.config
+
+# Build results
+
+[Dd]ebug/
+[Rr]elease/
+x64/
+build/
+[Bb]in/
+[Oo]bj/
+
+# MSTest test Results
+[Tt]est[Rr]esult*/
+[Bb]uild[Ll]og.*
+
+*_i.c
+*_p.c
+*.ilk
+*.meta
+*.obj
+*.pch
+*.pdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.tmp_proj
+*.log
+*.vspscc
+*.vssscc
+.builds
+*.pidb
+*.log
+*.scc
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opensdf
+*.sdf
+*.cachefile
+
+# Visual Studio profiler
+*.psess
+*.vsp
+*.vspx
+
+# Guidance Automation Toolkit
+*.gpState
+
+# ReSharper is a .NET coding add-in
+_ReSharper*/
+*.[Rr]e[Ss]harper
+
+# TeamCity is a build add-in
+_TeamCity*
+
+# DotCover is a Code Coverage Tool
+*.dotCover
+
+# NCrunch
+*.ncrunch*
+.*crunch*.local.xml
+
+# Installshield output folder
+[Ee]xpress/
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish/
+
+# Publish Web Output
+*.Publish.xml
+*.pubxml
+
+# NuGet Packages Directory
+## TODO: If you have NuGet Package Restore enabled, uncomment the next line
+#packages/
+
+# Windows Azure Build Output
+csx
+*.build.csdef
+
+# Windows Store app package directory
+AppPackages/
+
+# Others
+sql/
+*.Cache
+ClientBin/
+[Ss]tyle[Cc]op.*
+~$*
+*~
+*.dbmdl
+*.[Pp]ublish.xml
+*.pfx
+*.publishsettings
+
+# RIA/Silverlight projects
+Generated_Code/
+
+# Backup & report files from converting an old project file to a newer
+# Visual Studio version. Backup files are not needed, because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+UpgradeLog*.htm
+
+# SQL Server files
+App_Data/*.mdf
+App_Data/*.ldf
+
+# =========================
+# Windows detritus
+# =========================
+
+# Windows image file caches
+Thumbs.db
+ehthumbs.db
+
+# Folder config file
+Desktop.ini
+
+# Recycle Bin used on file shares
+$RECYCLE.BIN/
+
+# Mac crap
+.DS_Store
+
+# Intellij
+.idea

http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/LICENSE
----------------------------------------------------------------------
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..e06d208
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,202 @@
+Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "{}"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright {yyyy} {name of copyright owner}
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+

http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/NOTICE
----------------------------------------------------------------------
diff --git a/NOTICE b/NOTICE
new file mode 100644
index 0000000..84a2bf0
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1,56 @@
+Apache Usergrid 
+Copyright (c) The Apache Software Foundation.
+
+This product uses the following software:
+
+
+# Software distributed with/compiled into NSubstitute
+
+## Castle.Core
+NSubstitute is built on the Castle.Core library, particularly 
Castle.DynamicProxy 
+which is used for generating proxies for types and intercepting calls 
+made to them so that NSubstitute can record them. 
+
+Castle.Core is maintained by the Castle Project 
[http://www.castleproject.org/] 
+and is released under the Apache License, Version 2.0 
+[http://www.apache.org/licenses/LICENSE-2.0.html].
+
+# Software used to help build NSubstitute
+
+## NUnit [http://www.nunit.org/]
+NUnit is used for coding and running unit and integration tests for 
NSubstitute. It is distributed under an open source zlib/libpng based license 
[http://www.opensource.org/licenses/zlib-license.html].
+
+## Rhino Mocks [http://www.ayende.com/projects/rhino-mocks.aspx]
+Used for mocking parts of the NSubstitute mocking framework for testing. It is 
distributed under the BSD license 
[http://www.opensource.org/licenses/bsd-license.php].
+
+## Moq [http://moq.me/]
+Moq is not used in NSubstitute, but was a great source of inspiration. Moq 
pioneered Arrange-Act-Assert (AAA) mocking syntax for .NET, as well as removing 
the distinction between mocks and stubs, both of which have become important 
parts of NSubstitute. Moq is available under the BSD license 
[http://www.opensource.org/licenses/bsd-license.php].
+
+## NuPack [http://nupack.codeplex.com/]
+Used for packaging NSubstitute for distribution as a nu package. Distributed 
under the Apache License, Version 2.0 
[http://www.apache.org/licenses/LICENSE-2.0.html].
+
+## Jekyll [http://jekyllrb.com/]
+Static website generator written in Ruby, used for NSubstitute's website and 
documentation. Distributed under the MIT license 
[http://www.opensource.org/licenses/bsd-license.php].
+
+## SyntaxHighlighter [http://alexgorbatchev.com/SyntaxHighlighter/]
+Open source, JavaScript, client-side code highlighter used for highlighting 
code samples on the NSubstitute website. Distributed under the MIT License 
[http://en.wikipedia.org/wiki/MIT_License] and the GPL 
[http://www.gnu.org/copyleft/lesser.html].
+
+## Ruby (and libraries) [http://www.ruby-lang.org]
+Ruby is used for NSubstitute's build. The rake library is used to run the 
build; custom Ruby code is used to extract and test code samples from 
documentation; rspec is used to test that Ruby code; Markdown is used for 
documentation; gems for installing all this stuff; RubyInstaller for Windows 
and DevKit for interop with Windows; and much more. Ruby is awesome, as are the 
many projects contributed to the Ruby community that make developers' lives 
awesome.
+
+Ruby is distributed under the Ruby license 
[http://www.ruby-lang.org/en/LICENSE.txt]. The libraries mentioned are 
available under a variety of licenses. Please see their websites for more 
information.
+
+## Microsoft .NET Framework [http://www.microsoft.com/net/]
+NSubstitute is coded in C# and compiled using Microsoft .NET. It can also run 
and compile under Mono [http://www.mono-project.com], an open source 
implementation of the open .NET standards for C# and the CLI.
+
+Microsoft's .NET Framework is available under a EULA (and possibly other 
licenses like MS Reference Source License).
+Mono is available under four open source licenses for different parts of the 
project (including MIT/X11, GPL, MS-Pl). These are described on the project 
site [http://www.mono-project.com/Licensing].
+
+## Microsoft Ilmerge 
[http://research.microsoft.com/en-us/people/mbarnett/ilmerge.aspx]
+Used for combining assemblies so NSubstitute can be distributed as a single 
DLL. Available for use under a EULA as described on the ilmerge site.
+
+## Microsoft Reactive Extensions for .NET (Rx) 
[http://msdn.microsoft.com/en-us/devlabs/ee794896]
+Used to provide .NET 3.5 with some of the neat concurrency helper classes that 
ship with out of the box with .NET 4.0. Distributed under a EULA 
[http://msdn.microsoft.com/en-us/devlabs/ff394099].
+
+## 7-Zip [http://www.7-zip.org/]
+7-zip is used to ZIP up NSubstitute distributions as part of the automated 
build process. Distributed under a mixed GNU LGPL / unRAR licence 
[http://www.7-zip.org/license.txt].
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..b0861b5
--- /dev/null
+++ b/README.md
@@ -0,0 +1,316 @@
+# Usergrid .NET SDK
+
+## Version
+Current version is v0.1.0. All assemblies are marked with this version number.
+
+## Assemblies
+Solution is composed of following projects:
+
+* Usergrid.Sdk - this is the main .NET SDK project.
+* Usergrid.Sdk.Tests - this is the unit test project.
+* Usergrid.Sdk.IntegrationTests - this is the integration test project.
+
+## Comments and Questions
+Please feel free to send your comments/suggestions/questions one of the
+several communication platforms. 
+<http://usergrid.apache.org/community/>
+    
+## Overview
+We welcome your contributions and suggestions. The repository is located 
[here][RepositoryLocation].
+
+You can download this package here:
+
+* Download as a development [zip file][ZipFileLocation] SNAPSHOT
+
+## Installing
+Usergrid .NET SDK can be installed via:
+
+* Build source and reference Usergrid.Sdk assembly OR
+* Use Nuget
+
+### Building from Source
+If you prefer to build the assembly from source, head over to 
[here][RepositoryLocation], download/clone the source files and build. Source 
can be compiled via VS Studio 2010 or using Xamarin tools.
+
+### Using Nuget
+@TODO
+
+### Getting Started
+The main facade to all SDK functionality is provided by the Client class 
(which can also be injected using IClient):
+
+       var client = new Client("YourOrgName", "YourAppName");
+
+By default any method invoked using this client interacts with Usergrid 
without any authentication tokens. You can use this to access your "Sandbox" 
application which comes with all new Usergrid accounts - please see [Creating a 
sandbox 
app](http://usergrid.apache.org/docs/using-usergrid/creating-a-new-application.html)
 for more information.
+
+If you are ready to authenticate, then you can get an access token via login 
method:
+
+       client.Login("loginId", "loginSecret", AuthType.ClientId);
+       
+This method authenticates with Usergrid and attaches the retrieved access 
token to this client instance.
+
+Above example uses your client credentials to access Usergrid - note that this 
is not the only credentials/method you can use, please see "Authentication" 
section below.
+
+You are now ready to use this client instance to make calls to Usergrid.
+
+### Running Integration Tests
+In order to run the integration tests, do the following:
+
+* Open Usergrid.Sdk.IntegrationTests.dll.config and configure all 
configuration items according to your own setup.
+* Tests have been implemented using NUnit, so you can use any NUnit runner to 
run the tests.
+
+## Authentication
+Usergrid Authentication is explained in [Usergrid 
Documentation](http://usergrid.apache.org/docs/).
+
+You can access your Usergrid data using following credentials:
+
+### Organization API Credentials
+You can find your organisation's credentials on the "Org Overview" page of the 
[Admin Portal](https://github.com/apache/usergrid/tree/master/portal). Once you 
located your organisation credentials, you can pass them to the Login method 
instance:
+
+       client.Login("clientId", "clientSecret", AuthType.Organization);
+
+### Application Credentials
+You can find an application's credentials on the "App Settings" page of the 
[Admin Portal](https://github.com/apache/usergrid/tree/master/portal). Once you 
located your application credentials, you can pass them to the Login method:
+
+       client.Login("applicationId", "applicationSecret", 
AuthType.Application);
+       
+### Admin and User Credentials
+You can find a list of all admin users on the "Org Overview" page of the 
[Admin Portal](https://github.com/apache/usergrid/tree/master/portal). 
+
+You can pass the credentials of a user (admin or normal user) to the Login 
method:
+
+       client.Login("userLoginId", "userSecret", AuthType.User);
+
+## Entities and Collections
+Usergrid stores its data as "Entities" in "Collections".  Entities are 
essentially JSON objects and Collections are just like folders for storing 
these objects. You can learn more about Entities and Collections in the App 
Services docs.
+
+### Entities
+```
+T CreateEntity<T>(string collection, T entity);
+void DeleteEntity(string collection, string name);
+void UpdateEntity<T>(string collection, string identifier, T entity);
+T GetEntity<T>(string collectionName, string identifer);
+```
+
+All Entity CRUD operations are supported as individual methods in Client 
class. SDK handles JSON de/serialisation of your entities.
+
+Every entity in Usergrid has common default properties, like name, uuid, type, 
created, modified, etc. While modelling your entities, you should note the 
following:
+
+* Each entity has a unique UUID assigned to it. You can also assign your own 
id property to an entity.
+* For entities of type user, the username property value must be unique.
+* For all other entity types, the name property value must be unique and is 
immutable. This means that once you set it, it cannot be changed.
+
+You can model your entities in the following ways:
+
+* Inherit from UsergridEntity - base Entity class in .NET SDK. It defines all 
common/default properties for entities. If you choose to derive your own 
entities from UsergridEntity, then you don't need to deal with the definition 
and de/serialisation of those default properties. UsergridEntity code is under 
Usergrid.SDK/Model/UsergridEntity.cs. Please see ShouldCrudUsergridEntity 
method in [EntityCrudTests.cs][] under Usergrid.Sdk.IntegrationTests project 
for example usage.
+* Use your own entity classes - if you choose not to inherit from 
UsergridEntity, then you will need to include the properties that you care 
about yourself. SDK will still handle the JSON de/serialisation for your 
entities. Please see ShouldCrudPocoEntity method in [EntityCrudTests.cs][] 
under Usergrid.Sdk.IntegrationTests project.  
+
+### Collections
+```
+UsergridCollection<T> GetEntities<T>(string collection, int limit = 10, string 
query = null);
+UsergridCollection<T> GetNextEntities<T>(string collection, string query = 
null);
+UsergridCollection<T> GetPreviousEntities<T>(string collection, string query = 
null);
+```
+The Collection object models Collections in the database.  Once you start 
programming your app, you will likely find that this is the most useful method 
of interacting with the database.
+
+SDK defines a class UsergridCollection<T> in order to model collections. 
Implementation inherits from List<T> and also supports paging within the 
collection items.
+
+Please see @TODO link to EntityPagingTests.cs for example paging 
implementation.
+
+## Users and Groups
+```
+T GetUser<T>(string identifer /*username or uuid or email*/) where T : 
UsergridUser;
+void CreateUser<T>(T user) where T : UsergridUser;
+void UpdateUser<T>(T user) where T : UsergridUser;
+void DeleteUser(string identifer /*username or uuid or email*/);
+void ChangePassword(string identifer /*username or uuid or email*/, string 
oldPassword, string newPassword);
+void CreateGroup<T>(T group) where T : UsergridGroup;
+void DeleteGroup(string path);
+T GetGroup<T>(string identifer /*uuid or path*/) where T : UsergridGroup;
+void UpdateGroup<T>(T group) where T : UsergridGroup;
+void AddUserToGroup(string groupIdentifier, string userName);
+void DeleteUserFromGroup(string groupIdentifier, string userIdentifier);
+```
+A user entity represents an application user. Using App services APIs you can 
create, retrieve, update, delete, and query user entities.
+
+A group entity organizes users into a group. Using App Services APIs you can 
create, retrieve, update, or delete a group. You can also add or delete a user 
to or from a group.
+
+SDK contains special classes - UsergridUser and UsergridGroup - which models a 
Usergrid User and Group. You can derive from these classes and add your own 
properties.
+There are a couple of things you need to be aware of when working with users 
and groups.
+
+For users:
+* UserName property must be unique and it is mandatory.
+* Email property must be unique
+* For more information check the 
[documentation](http://usergrid.apache.org/docs/user-management/user-management.html)
 on users.
+
+For groups:
+* Path property must be unique and it is mandatory.
+* For more information check the 
[documentation](http://usergrid.apache.org/docs/user-management/user-management.html)
 on groups.
+ 
+Please see [GroupTests.cs][] and [UserManagementTests.cs][] for integration 
tests.
+
+## Activities and Feeds
+```
+void PostActivity<T>(string userIdentifier, T activity) where 
T:UsergridActivity;
+void PostActivityToGroup<T>(string groupIdentifier, T activity) where 
T:UsergridActivity;
+void PostActivityToUsersFollowersInGroup<T>(string userIdentifier, string 
groupIdentifier, T activity) where T:UsergridActivity;
+UsergridCollection<T> GetUserActivities<T>(string userIdentifier) where 
T:UsergridActivity;
+UsergridCollection<T> GetGroupActivities<T>(string groupIdentifier) where 
T:UsergridActivity;
+UsergridCollection<T> GetUserFeed<T>(string userIdentifier) where T : 
UsergridActivity;
+UsergridCollection<T> GetGroupFeed<T>(string groupIdentifier) where T : 
UsergridActivity;
+```
+An activity is an entity type that represents activity stream (feed) actions.
+
+#### Creating an activity
+
+The SDK provides UsergridActivity and UsergridActor classes to create an 
activity for a user. Here is some sample code from [ActivitiesTests.cs][] which 
creates an activity for a user.
+```
+userFromUsergrid = client.GetUser<UsergridUser> (username);
+
+// Create an activity for this user
+var activityEntity = new UsergridActivity {
+Actor = new UsergridActor
+{
+       DisplayName = "Joe Doe",
+       Email = userFromUsergrid.Email,
+       UserName = userFromUsergrid.UserName,
+       Uuid = userFromUsergrid.Uuid,
+       Image = new UsergridImage
+       {
+               Height = 10,
+               Width = 20,
+               Duration = 0,
+               Url = "apigee.com"
+       }
+},
+Content = "Hello Usergrid",
+Verb = "post"
+};
+
+client.PostActivity (userFromUsergrid.UserName, activityEntity);
+```
+You can also post an activity to a group with the PostActivityToGroup method 
`client.PostActivityToGroup (groupName, activityEntity);`
+
+
+## Devices
+```
+T GetDevice<T>(string identifer) where T : UsergridDevice;
+void UpdateDevice<T>(T device) where T : UsergridDevice;
+void CreateDevice<T>(T device) where T : UsergridDevice;
+void DeleteDevice(string identifer);
+```
+You can derive your own class from UserdridDevice to add your own properties 
and perform CRUD operations on devices.
+  You can find the integration tests for devices in [DeviceTests.cs][]
+
+## Connections
+```
+void CreateConnection(Connection connection);
+IList<UsergridEntity> GetConnections(Connection connection);
+IList<TConnectee> GetConnections<TConnectee>(Connection connection);
+void DeleteConnection(Connection connection);
+```
+
+In the SDK, connections are configured with the [Connection][] class, which 
holds the connector/connectee details and the connection name.ConnectionName 
property is a mandatory field when managing the connections.  
+To create and delete a connection, you'll need to populate all the fields in 
the connection object.  
+Connections can reference any type of entity, if you want to get all entities 
in a connection, you only need to populate connector details plus the 
connection name and use the non generic version of the GetConnections method. 
This will give you a list of UsergridEntity.
+```
+//get the connections, supply only the connector details
+//we get a list of Usergrid entites
+IList<UsergridEntity> allConnections = client.GetConnections(new Connection()
+    {
+        ConnectorCollectionName = "customers", 
+        ConnectorIdentifier = "customer1", 
+        ConnectionName = "has"
+    });
+```
+To get a list of a specific type of an entity, you also need to populate the 
connectee connection name and use the generic version of the GetConnections 
method.
+```
+//now, just get the orders for customer from the connection
+//we need to supply the connectee collection name
+IList<Order> orderConnections = client.GetConnections<Order>(new Connection()
+    {
+        ConnectorCollectionName = "customers", 
+        ConnectorIdentifier = "customer1", 
+        ConnecteeCollectionName = "orders", 
+        ConnectionName = "has"
+    });
+```
+Check [ConnectionTests.cs][] for the integration tests, and documentation on 
[Entity relationships][UsergridEntityRrelationshipsDoc].
+
+## Push Notifications
+
+```
+void CreateNotifierForApple(string notifierName, string environment, string 
p12CertificatePath);
+void CreateNotifierForAndroid(string notifierName, string apiKey);
+T GetNotifier<T>(string identifer/*uuid or notifier name*/) where T : 
UsergridNotifier;
+void DeleteNotifier(string notifierName);
+```
+
+You can send notifications to devices, users, or groups. But first, you need 
to register your app with push notification providers. This is explained in 
detail [here][RegisterYourAppDoc].  
+Once you've rgistered your app you need to create a notifier for it. 
Notifiers, which you explicitly create and add to notifications, contain the 
credentials necessary to securely access push notification providers--which in 
turn send your notifications to targeted devices. 
+#### Creating notifiers
+You need to give your notifier a name and then call the relevant method for 
your provider to create it. For example, to create a notifier for android :
+```
+const string notifierName = "test_notifier";
+...
+client.CreateNotifierForAndroid(notifierName, GoogleApiKey /*e.g. 
AIzaSyCkXOtBQ7A9GoJsSLqZlod_YjEfxxxxxxx*/);
+```
+You can check for existance of a notifier with the `GetNotifier` method which 
expects a notifier name, and returns a [UsergridNotifier][].
+####Publishing notifications
+To publish a notification you need to  
+
+* Create notification objects with your message
+
+Assuming you have created two notifiers (one for apple one for android)
+```
+const string appleTestMessge = "test message for Apple";
+const string androidTestMessage = "test message for Android";
+...
+var appleNotification = new AppleNotification(appleNotifierName, 
appleTestMessge, "chime");
+var googleNotification = new AndroidNotification(googleNotifierName, 
androidTestMessage);
+```
+*  Setup your recipients
+
+Use NotificationRecipients class, which provides builder methods for setting 
up recipients. For example if you want to send your message to a user:
+```
+INotificationRecipients recipients = new 
NotificationRecipients().AddUserWithName(username);
+```
+You can check the behaviour of the NotificationRecipients class in 
[NotificationRecipientsTests][].
+
+*  Setup scheduling
+
+You can schedule a notification to be delivered or to be exipred at a certain 
date time. This is done using NotificationSchedulerSettings. For example, if 
you want your message to be delivered tomorrow:
+```
+var schedulerSettings = new NotificationSchedulerSettings {DeliverAt = 
DateTime.Now.AddDays(1)};
+```
+
+*  and publish
+
+You can publish more than one notification, PublishNotification method accepts 
an array of notifications, recipients and the scheduler settings:
+
+```
+client.PublishNotification(new Notification[] {appleNotification, 
googleNotification}, recipients, schedulerSettings);
+```
+
+Integration tests are in [NotificationTests.cs][], and you can read about the 
push notifications in Usergrid documentation [here][PushNotificationsDoc].
+
+
+
+<!---Code reference-->
+[GroupTests.cs]: @TODO
+[UserManagementTests.cs]: @TODO
+[ActivitiesTests.cs]: @TODO
+[DeviceTests.cs]: @TODO
+[Connection]: @TODO
+[ConnectionTests.cs]: @TODO
+[RepositoryLocation]: https://github.com/apache/usergrid-dotnet
+[ZipFileLocation]: @TODO
+[TarGzFileLocation]: @TODO
+[EntityCrudTests.cs]: @TODO
+
+
+[UsergridNotifier]: @TODO
+[NotificationRecipientsTests]: @TODO
+[NotificationTests.cs]: @TODO
+<!---Docs-->
+[PushNotificationsDoc]: 
http://usergrid.apache.org/docs/push-notifications/overview.html
+[RegisterYourAppDoc]: @TODO
+[UsergridEntityRrelationshipsDoc]:@TODO

http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/Usergrid.Sdk.IntegrationTests/ActivitiesTests.cs
----------------------------------------------------------------------
diff --git a/Usergrid.Sdk.IntegrationTests/ActivitiesTests.cs 
b/Usergrid.Sdk.IntegrationTests/ActivitiesTests.cs
new file mode 100644
index 0000000..89bf2ef
--- /dev/null
+++ b/Usergrid.Sdk.IntegrationTests/ActivitiesTests.cs
@@ -0,0 +1,174 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+using System;
+using NUnit.Framework;
+using Usergrid.Sdk.Model;
+
+namespace Usergrid.Sdk.IntegrationTests
+{
+       [TestFixture]
+       public class ActivitiesTests : BaseTest
+       {
+        private IClient _client;
+        [SetUp]
+        public void Setup()
+        {
+            _client = InitializeClientAndLogin(AuthType.Organization);
+        }
+
+               [Test]
+               public void ShouldCreateAndRetrieveUserActivities()
+               {
+            // Create a user
+            var usergridUser = SetupUsergridUser(_client, new UsergridUser { 
UserName = "test_user", Email = "test_u...@apigee.com" });
+                       // Create an activity for this user
+                       var activityEntity = new UsergridActivity {
+                               Actor = new UsergridActor
+                               {
+                                       DisplayName = "Joe Doe",
+                    Email = usergridUser.Email,
+                    UserName = usergridUser.UserName,
+                    Uuid = usergridUser.Uuid,
+                                       Image = new UsergridImage
+                                       {
+                                               Height = 10,
+                                               Width = 20,
+                                               Duration = 0,
+                                               Url = "apigee.com"
+                                       }
+                               },
+                               Content = "Hello Usergrid",
+                               Verb = "post"
+                       };
+
+            _client.PostActivity(usergridUser.UserName, activityEntity);
+
+                       // Get the activities
+            var activities = 
_client.GetUserActivities<UsergridActivity>(usergridUser.UserName);
+                       Assert.IsNotNull (activities);
+                       Assert.AreEqual (1, activities.Count);
+                       var thisActivity = activities [0];
+                       Assert.AreEqual ("Joe Doe", 
thisActivity.Actor.DisplayName);
+            Assert.AreEqual(usergridUser.Email, thisActivity.Actor.Email);
+                       Assert.AreEqual (10, thisActivity.Actor.Image.Height);
+                       Assert.AreEqual (20, thisActivity.Actor.Image.Width);
+                       Assert.AreEqual ("Hello Usergrid", 
thisActivity.Content);
+                       Assert.IsTrue (thisActivity.PublishedDate > 
DateTime.Now.ToUniversalTime().AddHours(-1));
+
+                       // Get the feed
+            var feed = 
_client.GetUserFeed<UsergridActivity>(usergridUser.UserName);
+                       Assert.IsNotNull (feed);
+                       Assert.AreEqual (1, feed.Count);
+                       thisActivity = feed [0];
+                       Assert.AreEqual ("Joe Doe", 
thisActivity.Actor.DisplayName);
+            Assert.AreEqual(usergridUser.Email, thisActivity.Actor.Email);
+                       Assert.AreEqual (10, thisActivity.Actor.Image.Height);
+                       Assert.AreEqual (20, thisActivity.Actor.Image.Width);
+                       Assert.AreEqual ("Hello Usergrid", 
thisActivity.Content);
+                       Assert.IsTrue (thisActivity.PublishedDate > 
DateTime.Now.ToUniversalTime().AddHours(-1));
+               }
+
+               [Test]
+               public void ShouldCreateAndRetrieveGroupActivities()
+               {
+
+            // Create a user
+            var usergridUser = SetupUsergridUser(_client, new UsergridUser { 
UserName = "test_user", Email = "test_u...@apigee.com" });
+            // Create a group
+            var usergridGroup = SetupUsergridGroup(_client, new UsergridGroup 
{ Path = "test-group", Title = "mygrouptitle" });
+
+                       // Create an activity for this group
+                       var activityEntity = new UsergridActivity {
+                               Actor = new UsergridActor
+                               {
+                                       DisplayName = "Joe Doe",
+                    Email = usergridUser.Email,
+                    UserName = usergridUser.UserName,
+                    Uuid = usergridUser.Uuid,
+                                       Image = new UsergridImage
+                                       {
+                                               Height = 10,
+                                               Width = 20,
+                                               Duration = 0,
+                                               Url = "apigee.com"
+                                       }
+                               },
+                               Content = "Hello Usergrid",
+                               Verb = "post"
+                       };
+
+            _client.PostActivityToGroup(usergridGroup.Path, activityEntity);
+
+                       // Get the activities
+            var activities = 
_client.GetGroupActivities<UsergridActivity>(usergridGroup.Path);
+                       Assert.IsNotNull (activities);
+                       Assert.AreEqual (1, activities.Count);
+                       var thisActivity = activities [0];
+                       Assert.AreEqual ("Joe Doe", 
thisActivity.Actor.DisplayName);
+                       Assert.AreEqual (usergridUser.Email, 
thisActivity.Actor.Email);
+                       Assert.AreEqual (10, thisActivity.Actor.Image.Height);
+                       Assert.AreEqual (20, thisActivity.Actor.Image.Width);
+                       Assert.AreEqual ("Hello Usergrid", 
thisActivity.Content);
+                       Assert.IsTrue (thisActivity.PublishedDate > 
DateTime.Now.ToUniversalTime().AddHours(-1));
+
+                       // Get the feed
+            var feed = 
_client.GetGroupFeed<UsergridActivity>(usergridGroup.Path);
+                       Assert.IsNotNull (feed);
+                       Assert.AreEqual (1, feed.Count);
+                       thisActivity = feed [0];
+                       Assert.AreEqual ("Joe Doe", 
thisActivity.Actor.DisplayName);
+            Assert.AreEqual(usergridUser.Email, thisActivity.Actor.Email);
+                       Assert.AreEqual (10, thisActivity.Actor.Image.Height);
+                       Assert.AreEqual (20, thisActivity.Actor.Image.Width);
+                       Assert.AreEqual ("Hello Usergrid", 
thisActivity.Content);
+                       Assert.IsTrue (thisActivity.PublishedDate > 
DateTime.Now.ToUniversalTime().AddHours(-1));
+               }
+       
+               [Test]
+               public void ShouldCreateAndRetrieveUsersFollowersActivities()
+               {
+                       
+
+            // Create a user
+            var usergridUser = SetupUsergridUser(_client, new UsergridUser { 
UserName = "test_user", Email = "test_u...@apigee.com" });
+            // Create a group
+            var usergridGroup = SetupUsergridGroup(_client, new UsergridGroup 
{ Path = "test-group", Title = "mygrouptitle" });
+
+
+                       // Create an activity for this group
+            var activityEntity = new UsergridActivity(usergridUser)
+            {
+                               Content = "Hello Usergrid",
+                               Verb = "post"
+                       };
+
+            _client.PostActivityToUsersFollowersInGroup(usergridUser.UserName, 
usergridGroup.Path, activityEntity);
+
+                       // Get the activities
+            var activities = 
_client.GetUserActivities<UsergridActivity>(usergridUser.UserName);
+                       Assert.IsNotNull (activities);
+                       Assert.AreEqual (1, activities.Count);
+                       var thisActivity = activities [0];
+            Assert.AreEqual(usergridUser.Name, thisActivity.Actor.DisplayName);
+            Assert.AreEqual(usergridUser.Email, thisActivity.Actor.Email);
+                       Assert.IsNull (thisActivity.Actor.Image);
+                       Assert.AreEqual ("Hello Usergrid", 
thisActivity.Content);
+                       Assert.IsTrue (thisActivity.PublishedDate > 
DateTime.Now.ToUniversalTime().AddHours(-1));
+               }
+       }
+
+}
+

http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/Usergrid.Sdk.IntegrationTests/BaseTest.cs
----------------------------------------------------------------------
diff --git a/Usergrid.Sdk.IntegrationTests/BaseTest.cs 
b/Usergrid.Sdk.IntegrationTests/BaseTest.cs
new file mode 100644
index 0000000..b83cf7e
--- /dev/null
+++ b/Usergrid.Sdk.IntegrationTests/BaseTest.cs
@@ -0,0 +1,163 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+using System;
+using System.Configuration;
+using Usergrid.Sdk.Model;
+
+namespace Usergrid.Sdk.IntegrationTests
+{
+       public class BaseTest
+       {
+               private static Random random = new 
Random(DateTime.Now.Millisecond);
+
+           private readonly Configuration _config;
+           public BaseTest()
+           {
+            var configMap = new ExeConfigurationFileMap {ExeConfigFilename = 
"MySettings.config"};
+                       Configuration config = 
ConfigurationManager.OpenMappedExeConfiguration(configMap, 
ConfigurationUserLevel.None);
+               if (config.HasFile && config.AppSettings.Settings.Count > 0)
+                   _config = config;
+           }
+
+        /// <summary>
+        /// The URI of the Usergrid API, which defaults to api.usergrid.com if 
none is specified, just like the Client object does
+        /// </summary>
+        protected string ApiUri
+        {
+            get
+            {
+                var apiUri = GetAppSetting("apiUri");
+                if (String.IsNullOrWhiteSpace(apiUri))
+                {
+                    apiUri = "http://api.usergrid.com";;
+                }
+
+                return apiUri;
+            }
+        }
+
+        protected string Organization
+               {
+                       get{ return GetAppSetting("organization");}
+               }
+
+               protected string Application
+               {
+                       get{ return GetAppSetting("application");}
+               }
+
+               protected string ClientId
+               {
+                       get { return GetAppSetting("clientId");}
+               }
+
+               protected string ClientSecret
+               {
+                       get{ return GetAppSetting("clientSecret");}
+               }
+
+               protected string ApplicationId
+               {
+                       get {return GetAppSetting("applicationId");}
+               }
+
+               protected string ApplicationSecret
+               {
+                       get {return GetAppSetting ("applicationSecret");}
+               }
+
+               protected string UserId
+               {
+                       get { return GetAppSetting("userId");}
+               }
+
+               protected string UserSecret
+               {
+                       get{ return GetAppSetting("userSecret");}
+               }
+
+        protected string P12CertificatePath
+               {
+            get { return GetAppSetting("p12CertificatePath"); }
+               }
+
+        protected string GoogleApiKey
+               {
+            get { return GetAppSetting("googleApiKey"); }
+               }
+
+        private string GetAppSetting(string key)
+        {
+            return _config == null ? ConfigurationManager.AppSettings[key] : 
_config.AppSettings.Settings[key]?.Value;
+        }
+
+        protected IClient InitializeClientAndLogin(AuthType authType)
+        {
+            var client = new Client(Organization, Application, ApiUri);
+            if (authType == AuthType.Application || authType == 
AuthType.Organization)
+                client.Login(ClientId, ClientSecret, authType);
+            else if (authType == AuthType.User)
+                client.Login(UserId, UserSecret, authType);
+
+            return client;
+        }
+
+               protected static int GetRandomInteger(int minValue, int 
maxValue)
+               {
+                       return random.Next (minValue, maxValue);
+               }
+
+           protected void DeleteEntityIfExists<TEntity>(IClient client, string 
collectionName, string entityIdentifier)
+           {
+               TEntity customer = client.GetEntity<TEntity>(collectionName, 
entityIdentifier);
+
+               if (customer != null)
+                   client.DeleteEntity(collectionName, entityIdentifier);
+           }
+
+           protected void DeleteDeviceIfExists(IClient client, string 
deviceName)
+           {
+               UsergridDevice usergridDevice = 
client.GetDevice<UsergridDevice>(deviceName);
+               if (usergridDevice != null)
+                   client.DeleteDevice(usergridDevice.Uuid);
+           }
+
+        protected void DeleteUserIfExists(IClient client, string userName)
+           {
+            UsergridUser existingUser = client.GetUser<UsergridUser>(userName);
+            if (existingUser != null)
+                client.DeleteUser(existingUser.Uuid);
+        }
+
+        protected UsergridUser SetupUsergridUser(IClient client, UsergridUser 
user)
+           {
+            DeleteUserIfExists(client, user.UserName);
+            client.CreateUser(user);
+            return client.GetUser<UsergridUser>(user.UserName);
+           }
+        
+        protected UsergridGroup SetupUsergridGroup(IClient client, 
UsergridGroup @group)
+           {
+               var existingGroup = client.GetGroup<UsergridGroup>(@group.Path);
+            if (existingGroup != null)
+                client.DeleteGroup(existingGroup.Path);
+            client.CreateGroup(@group);
+            return client.GetGroup<UsergridGroup>(@group.Path);
+
+           }
+       }
+}
+

http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/Usergrid.Sdk.IntegrationTests/ConnectionTests.cs
----------------------------------------------------------------------
diff --git a/Usergrid.Sdk.IntegrationTests/ConnectionTests.cs 
b/Usergrid.Sdk.IntegrationTests/ConnectionTests.cs
new file mode 100644
index 0000000..294cee4
--- /dev/null
+++ b/Usergrid.Sdk.IntegrationTests/ConnectionTests.cs
@@ -0,0 +1,199 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+using System.Collections.Generic;
+using NUnit.Framework;
+using Usergrid.Sdk.Model;
+using System.Linq;
+
+namespace Usergrid.Sdk.IntegrationTests {
+    public class Customer {
+        public string Name { get; set; }
+        public string No { get; set; }
+    }
+
+    public class Order {
+        public string Name { get; set; }
+        public string Id { get; set; }
+    }
+
+    [TestFixture]
+    public class ConnectionTests : BaseTest {
+        [Test]
+        public void ShouldCreateAndGetSimpleConnection() {
+            IClient client = InitializeClientAndLogin(AuthType.Organization);
+            DeleteEntityIfExists<Customer>(client, "customers", "customer1");
+            DeleteEntityIfExists<Order>(client, "orders", "order1");
+            DeleteDeviceIfExists(client, "device1");
+
+            //create a customer, order and a device
+            //then we will connect the order entity and device entity to the 
customer using the same connection name (has)
+            //order and device are different types of entities
+            client.CreateEntity("customers", new Customer
+                {
+                    Name = "customer1",
+                    No = "1"
+                });
+            client.CreateEntity("orders", new Order
+                {
+                    Name = "order1",
+                    Id = "1"
+                });
+            client.CreateDevice(
+                new DeviceTests.MyCustomUserGridDevice()
+                    {
+                        Name = "device1",
+                        DeviceType = "device type"
+                    });
+
+            //create a connection between customer1 and order1
+            client.CreateConnection(new Connection()
+            {
+                ConnectorCollectionName = "customers",
+                ConnectorIdentifier = "customer1",
+                ConnecteeCollectionName = "orders",
+                ConnecteeIdentifier = "order1",
+                ConnectionName = "has"
+            });
+            //create a connection between customer1 and device1
+            client.CreateConnection(new Connection()
+            {
+                ConnectorCollectionName = "customers",
+                ConnectorIdentifier = "customer1",
+                ConnecteeCollectionName = "devices",
+                ConnecteeIdentifier = "device1",
+                ConnectionName = "has"
+            });
+
+            //get the connections, supply only the connector details
+            //we get a list of Usergrid entites
+            IList<UsergridEntity> allConnections = client.GetConnections(new 
Connection()
+                {
+                    ConnectorCollectionName = "customers", 
+                    ConnectorIdentifier = "customer1", 
+                    ConnectionName = "has"
+                });
+            Assert.AreEqual(2, allConnections.Count);
+            Assert.True(allConnections.Any(c=>c.Name == "order1"));
+            Assert.True(allConnections.Any(c=>c.Name == "device1"));
+
+            //now, just get the devices for customer from the connection
+            //we need to supply the connectee collection name
+            IList<DeviceTests.MyCustomUserGridDevice> deviceConnections = 
client.GetConnections<DeviceTests.MyCustomUserGridDevice>(new Connection()
+                {
+                    ConnectorCollectionName = "customers", 
+                    ConnectorIdentifier = "customer1", 
+                    ConnecteeCollectionName = "devices", 
+                    ConnectionName = "has"
+                });
+            Assert.AreEqual(1, deviceConnections.Count);
+            Assert.AreEqual("device1", deviceConnections[0].Name);
+
+            //now, just get the orders for customer from the connection
+            //we need to supply the connectee collection name
+            IList<Order> orderConnections = client.GetConnections<Order>(new 
Connection()
+                {
+                    ConnectorCollectionName = "customers", 
+                    ConnectorIdentifier = "customer1", 
+                    ConnecteeCollectionName = "orders", 
+                    ConnectionName = "has"
+                });
+            Assert.AreEqual(1, orderConnections.Count);
+            Assert.AreEqual("order1", orderConnections[0].Name);
+
+            //delete the connections
+            client.DeleteConnection(new Connection()
+            {
+                ConnectorCollectionName = "customers",
+                ConnectorIdentifier = "customer1",
+                ConnecteeCollectionName = "devices",
+                ConnecteeIdentifier = "device1",
+                ConnectionName = "has"
+            });
+            //delete the connections
+            client.DeleteConnection(new Connection()
+            {
+                ConnectorCollectionName = "customers",
+                ConnectorIdentifier = "customer1",
+                ConnecteeCollectionName = "orders",
+                ConnecteeIdentifier = "order1",
+                ConnectionName = "has"
+            });
+
+            //verify that it is deleted
+            var noConnections = client.GetConnections(new Connection()
+                {
+                    ConnectorCollectionName = "customers", 
+                    ConnectorIdentifier = "customer1", 
+                    ConnectionName = "has"
+                });
+            Assert.AreEqual(0, noConnections.Count);
+        }
+
+        [Test]
+        public void ShouldGetAndGetSimpleConnection() {
+            IClient client = InitializeClientAndLogin(AuthType.Organization);
+            DeleteEntityIfExists<Customer>(client, "customers", "customer1");
+            DeleteEntityIfExists<Order>(client, "orders", "order1");
+
+            client.CreateEntity("customers", new Customer
+                {
+                    Name = "customer1",
+                    No = "1"
+                });
+            client.CreateEntity("orders", new Order
+                {
+                    Name = "order1",
+                    Id = "1"
+                });
+
+            //to get a collection you need connector details and the 
connection name
+            var getConnectionDetails = new Connection()
+                {
+                    ConnectorCollectionName = "customers", 
+                    ConnectorIdentifier = "customer1", 
+                    ConnectionName = "has"
+                };
+            //to create/delete a collection you need all the connector and 
connectee details and the connection name.
+            var createDeleteConnectionDetails = new Connection()
+            {
+                ConnectorCollectionName = "customers",
+                ConnectorIdentifier = "customer1",
+                ConnecteeCollectionName = "orders",
+                ConnecteeIdentifier = "order1",
+                ConnectionName = "has"
+            };
+
+            //no connections yet
+            IList<UsergridEntity> connections = 
client.GetConnections(getConnectionDetails);
+            Assert.AreEqual(0, connections.Count);
+
+            //create a connection between customer1 and order1
+            client.CreateConnection(createDeleteConnectionDetails);
+
+            //verify the connection
+            connections = client.GetConnections(getConnectionDetails);
+            Assert.AreEqual(1, connections.Count);
+            Assert.AreEqual("order1", connections[0].Name);
+
+            //delete the connection
+            client.DeleteConnection(createDeleteConnectionDetails);
+
+            //verify that it is deleted
+            connections = client.GetConnections(getConnectionDetails);
+            Assert.AreEqual(0, connections.Count);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/Usergrid.Sdk.IntegrationTests/DeviceTests.cs
----------------------------------------------------------------------
diff --git a/Usergrid.Sdk.IntegrationTests/DeviceTests.cs 
b/Usergrid.Sdk.IntegrationTests/DeviceTests.cs
new file mode 100644
index 0000000..3710448
--- /dev/null
+++ b/Usergrid.Sdk.IntegrationTests/DeviceTests.cs
@@ -0,0 +1,63 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+using NUnit.Framework;
+using Usergrid.Sdk.Model;
+
+namespace Usergrid.Sdk.IntegrationTests
+{
+    [TestFixture]
+    public class DeviceTests : BaseTest
+    {
+        [Test]
+        public void ShouldCrudDevices()
+        {
+            const string deviceName = "test_device";
+            var client = InitializeClientAndLogin(AuthType.Organization);
+            DeleteDeviceIfExists(client, deviceName);
+
+            client.CreateDevice(new UsergridDevice() {Name = deviceName});
+            //get device and assert
+            UsergridDevice device = 
client.GetDevice<UsergridDevice>(deviceName);
+            Assert.That(device.Name, Is.EqualTo(deviceName));
+
+            //create a custom device
+            DeleteDeviceIfExists(client, deviceName);
+            const string deviceTypeiPhone = "iPhone";
+
+            client.CreateDevice(new MyCustomUserGridDevice() { Name = 
deviceName, DeviceType = deviceTypeiPhone });
+            //get device and assert
+            MyCustomUserGridDevice myCustomDevice = 
client.GetDevice<MyCustomUserGridDevice>(deviceName);
+            Assert.That(myCustomDevice.Name, Is.EqualTo(deviceName));
+            Assert.That(myCustomDevice.DeviceType, 
Is.EqualTo(deviceTypeiPhone));
+
+            //update device type
+            const string deviceTypeAndroid = "Android";
+
+            myCustomDevice.DeviceType = deviceTypeAndroid;
+            client.UpdateDevice(myCustomDevice);
+
+            //get device and assert
+            myCustomDevice = 
client.GetDevice<MyCustomUserGridDevice>(deviceName);
+            Assert.That(myCustomDevice.Name, Is.EqualTo(deviceName));
+            Assert.That(myCustomDevice.DeviceType, 
Is.EqualTo(deviceTypeAndroid));
+        }
+
+        public class MyCustomUserGridDevice : UsergridDevice
+        {
+            public string DeviceType { get; set; }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/Usergrid.Sdk.IntegrationTests/EntityCrudTests.cs
----------------------------------------------------------------------
diff --git a/Usergrid.Sdk.IntegrationTests/EntityCrudTests.cs 
b/Usergrid.Sdk.IntegrationTests/EntityCrudTests.cs
new file mode 100644
index 0000000..ffdd6c9
--- /dev/null
+++ b/Usergrid.Sdk.IntegrationTests/EntityCrudTests.cs
@@ -0,0 +1,153 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+using System;
+using NUnit.Framework;
+using Usergrid.Sdk.Model;
+
+namespace Usergrid.Sdk.IntegrationTests {
+    [TestFixture]
+    public class EntityCrudTests : BaseTest {
+        private IClient _client;
+        [SetUp]
+        public void Setup() {
+            _client = InitializeClientAndLogin(AuthType.Organization);
+        }
+
+        [Test]
+        public void ShouldCrudPocoEntity() {
+            const string collectionName = "friends";
+            var friend = new Friend
+                {
+                    Name = "EntityName",
+                    Age = 25
+                };
+
+            DeleteEntityIfExists<Friend>(_client, collectionName, friend.Name);
+
+            // Create a new entity
+            _client.CreateEntity(collectionName, friend);
+
+            // Get it back
+            var friendFromUsergrid = _client.GetEntity<Friend>(collectionName, 
friend.Name);
+
+            // Assert that the entity returned is correct
+            Assert.IsNotNull(friendFromUsergrid);
+            Assert.AreEqual(friend.Name, friendFromUsergrid.Name);
+            Assert.AreEqual(friend.Age, friendFromUsergrid.Age);
+
+            // Get it back with query
+            string query = "select * where name = '" + friend.Name + "'";
+            UsergridCollection<Friend> friends = 
_client.GetEntities<Friend>(collectionName, query: query);
+
+            // Assert the collection is correct
+            Assert.IsNotNull(friends);
+            Assert.AreEqual(1, friends.Count);
+            Assert.IsFalse(friends.HasNext);
+            Assert.IsFalse(friends.HasPrevious);
+            friendFromUsergrid = friends[0];
+            Assert.IsNotNull(friendFromUsergrid);
+            Assert.AreEqual(friend.Name, friendFromUsergrid.Name);
+            Assert.AreEqual(friend.Age, friendFromUsergrid.Age);
+
+
+            // Update the entity
+            Friend friendToUpdate = friendFromUsergrid;
+            friendToUpdate.Age = 30;
+            _client.UpdateEntity(collectionName, friendToUpdate.Name, 
friendToUpdate);
+
+            // Get it back
+            friendFromUsergrid = _client.GetEntity<Friend>(collectionName, 
friendToUpdate.Name);
+
+            // Assert that entity is updated
+            Assert.AreEqual(friendToUpdate.Age, friendFromUsergrid.Age);
+
+            // Delete the entity
+            _client.DeleteEntity(collectionName, friend.Name);
+
+            // Get it back
+            friendFromUsergrid = _client.GetEntity<Friend>(collectionName, 
friend.Name);
+
+            // Assert that it doesn't exist
+            Assert.IsNull(friendFromUsergrid);
+        }
+
+        [Test]
+        public void ShouldCrudUserGridEntity() {
+            const string collectionName = "friends";
+            var friend = new UsergridFriend
+                {
+                    Name = "EntityName",
+                    Age = 25
+                };
+
+            DeleteEntityIfExists<Friend>(_client, collectionName, friend.Name);
+
+            // Create a new entity
+            _client.CreateEntity(collectionName, friend);
+
+            // Get it back
+            var friendFromUsergrid = 
_client.GetEntity<UsergridFriend>(collectionName, friend.Name);
+
+            // Assert that the entity returned is correct
+            Assert.IsNotNull(friendFromUsergrid);
+            Assert.IsNotEmpty(friendFromUsergrid.Uuid);
+            Assert.IsNotEmpty(friendFromUsergrid.Type);
+            Assert.IsTrue(friendFromUsergrid.CreatedDate > DateTime.MinValue);
+            Assert.IsTrue(friendFromUsergrid.ModifiedDate > DateTime.MinValue);
+            Assert.AreEqual(friend.Name, friendFromUsergrid.Name);
+            Assert.AreEqual(friend.Age, friendFromUsergrid.Age);
+
+            // Get it back with query
+            string query = "select * where name = '" + friend.Name + "'";
+            UsergridCollection<UsergridFriend> friends = 
_client.GetEntities<UsergridFriend>(collectionName, query: query);
+
+            // Assert the collection is correct
+            Assert.IsNotNull(friends);
+            Assert.AreEqual(1, friends.Count);
+            Assert.IsFalse(friends.HasNext);
+            Assert.IsFalse(friends.HasPrevious);
+            friendFromUsergrid = friends[0];
+            Assert.IsNotNull(friendFromUsergrid);
+            Assert.AreEqual(friend.Name, friendFromUsergrid.Name);
+            Assert.AreEqual(friend.Age, friendFromUsergrid.Age);
+            Assert.IsNotEmpty(friendFromUsergrid.Uuid);
+            Assert.IsNotEmpty(friendFromUsergrid.Type);
+            Assert.IsTrue(friendFromUsergrid.CreatedDate > DateTime.MinValue);
+            Assert.IsTrue(friendFromUsergrid.ModifiedDate > DateTime.MinValue);
+
+
+            // Update the entity
+            UsergridFriend friendToUpdate = friendFromUsergrid;
+            friendToUpdate.Age = 30;
+            _client.UpdateEntity(collectionName, friendToUpdate.Name, 
friendToUpdate);
+
+            // Get it back
+            friendFromUsergrid = 
_client.GetEntity<UsergridFriend>(collectionName, friendToUpdate.Name);
+
+            // Assert that entity is updated
+            Assert.AreEqual(friendToUpdate.Age, friendFromUsergrid.Age);
+
+            // Delete the entity
+            _client.DeleteEntity(collectionName, friend.Name);
+
+            // Get it back
+            friendFromUsergrid = 
_client.GetEntity<UsergridFriend>(collectionName, friend.Name);
+
+            // Assert that it doesn't exist
+            Assert.IsNull(friendFromUsergrid);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/Usergrid.Sdk.IntegrationTests/EntityPagingTests.cs
----------------------------------------------------------------------
diff --git a/Usergrid.Sdk.IntegrationTests/EntityPagingTests.cs 
b/Usergrid.Sdk.IntegrationTests/EntityPagingTests.cs
new file mode 100644
index 0000000..79234de
--- /dev/null
+++ b/Usergrid.Sdk.IntegrationTests/EntityPagingTests.cs
@@ -0,0 +1,83 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+using System;
+using NUnit.Framework;
+using Usergrid.Sdk.Model;
+
+namespace Usergrid.Sdk.IntegrationTests
+{
+       public class Page
+       {
+               public int PageNumber {get;set;}
+               public string Name {get;set;}
+       }
+
+       [TestFixture]
+       public class EntityPagingTests : BaseTest
+       {
+               [Test]
+               public void ShouldDoPaging()
+               {
+                       var client = new Client(Organization, Application, 
ApiUri);
+                       client.Login(ClientId, ClientSecret, 
AuthType.Organization);
+
+                       for (var i=0; i<20; i++) 
+                       {
+                               try{
+                                       client.DeleteEntity ("pages", "page-" + 
i);
+                                       Console.WriteLine ("Deleted " + i);
+                               } catch (UsergridException) {
+                               }
+                       }
+
+                       for (var i=0; i<20; i++) 
+                       {
+                               var page = new Page { PageNumber = i, Name = 
"page-" + i };
+                               client.CreateEntity ("pages", page);
+                               Console.WriteLine ("Created " + i);
+                       }
+      
+
+                       var collection = client.GetEntities<Page> ("pages", 3);
+                       Assert.AreEqual (3, collection.Count);
+                       Assert.IsTrue (collection.HasNext);
+                       Assert.IsFalse (collection.HasPrevious);
+                       Assert.AreEqual ("page-1", collection [1].Name);
+
+                       collection = client.GetNextEntities<Page> ("pages");
+                       Assert.IsTrue (collection.HasNext);
+                       Assert.IsTrue (collection.HasPrevious);
+                       Assert.AreEqual ("page-4", collection [1].Name);
+
+                       collection = client.GetNextEntities<Page> ("pages");
+                       Assert.IsTrue (collection.HasNext);
+                       Assert.IsTrue (collection.HasPrevious);
+                       Assert.AreEqual ("page-7", collection [1].Name);
+
+                       collection = client.GetPreviousEntities<Page> ("pages");
+                       Assert.IsTrue (collection.HasNext);
+                       Assert.IsTrue (collection.HasPrevious);
+                       Assert.AreEqual ("page-4", collection [1].Name);
+
+                       for (var i=0; i<20; i++) 
+                       {
+                               client.DeleteEntity ("pages", "page-" + i);
+                               Console.WriteLine ("Deleted " + i);
+                       }
+               }
+       }
+}
+

http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/Usergrid.Sdk.IntegrationTests/Friend.cs
----------------------------------------------------------------------
diff --git a/Usergrid.Sdk.IntegrationTests/Friend.cs 
b/Usergrid.Sdk.IntegrationTests/Friend.cs
new file mode 100644
index 0000000..6b3af85
--- /dev/null
+++ b/Usergrid.Sdk.IntegrationTests/Friend.cs
@@ -0,0 +1,23 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+namespace Usergrid.Sdk.IntegrationTests
+{
+       public class Friend
+       {
+               public string Name { get; set; }
+               public int Age { get; set; }
+       }
+}

http://git-wip-us.apache.org/repos/asf/usergrid-dotnet/blob/94c0483c/Usergrid.Sdk.IntegrationTests/GroupTests.cs
----------------------------------------------------------------------
diff --git a/Usergrid.Sdk.IntegrationTests/GroupTests.cs 
b/Usergrid.Sdk.IntegrationTests/GroupTests.cs
new file mode 100644
index 0000000..4213c24
--- /dev/null
+++ b/Usergrid.Sdk.IntegrationTests/GroupTests.cs
@@ -0,0 +1,91 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+using System.Collections.Generic;
+using NUnit.Framework;
+using Usergrid.Sdk.Model;
+
+namespace Usergrid.Sdk.IntegrationTests
+{
+    public class MyUsergridGroup : UsergridGroup
+    {
+        public string Description { get; set; }
+    }
+
+    [TestFixture]
+    public class GroupTests : BaseTest
+    {
+        [Test]
+        public void ShouldManageGroupLifecycle()
+        {
+            var client = new Client(Organization, Application, ApiUri);
+            client.Login(ClientId, ClientSecret, AuthType.Organization);
+
+            var group = client.GetGroup<MyUsergridGroup>("group1");
+
+            if (group != null)
+                client.DeleteGroup("group1");
+
+            group = new MyUsergridGroup {Path = "group1", Title = "title1", 
Description = "desc1"};
+            client.CreateGroup(group);
+            group = client.GetGroup<MyUsergridGroup>("group1");
+
+            Assert.IsNotNull(group);
+            Assert.AreEqual("group1", group.Path);
+            Assert.AreEqual("title1", group.Title);
+            Assert.AreEqual("desc1", group.Description);
+
+            group.Description = "desc2";
+            group.Title = "title2";
+
+            client.UpdateGroup(group);
+
+            group = client.GetGroup<MyUsergridGroup>("group1");
+
+            Assert.IsNotNull(group);
+            Assert.AreEqual("group1", group.Path);
+            Assert.AreEqual("title2", group.Title);
+            Assert.AreEqual("desc2", group.Description);
+
+            client.DeleteGroup("group1");
+
+            group = client.GetGroup<MyUsergridGroup>("group1");
+            Assert.IsNull(group);
+        }
+        
+        [Test]
+        public void ShouldManageUsersInGroup()
+        {
+            var client = new Client(Organization, Application, ApiUri);
+            client.Login(ClientId, ClientSecret, AuthType.Organization);
+
+            var user = SetupUsergridUser(client, new MyUsergridUser {UserName 
= "user1", Password = "user1", Email = "us...@gmail.com", City = "city1"});
+            var group = SetupUsergridGroup(client, new MyUsergridGroup {Path = 
"group1", Title = "title1", Description = "desc1"});
+
+            client.AddUserToGroup(group.Path, user.UserName);
+            IList<UsergridUser> users = 
client.GetAllUsersInGroup<UsergridUser>(group.Path);
+            Assert.IsNotNull(users);
+            Assert.AreEqual(1, users.Count);
+
+            client.DeleteUserFromGroup("group1", "user1");
+            users = client.GetAllUsersInGroup<UsergridUser>(group.Path);
+            Assert.IsNotNull(users);
+            Assert.AreEqual(0, users.Count);
+
+            client.DeleteGroup("group1");
+            client.DeleteUser("user1");
+        }
+    }
+}

Reply via email to