Skip to content

Commit

Permalink
added two test cases and minor change to the documentation for single…
Browse files Browse the repository at this point in the history
… file collaboration (#425)
  • Loading branch information
carycheng77 authored Dec 20, 2017
1 parent 57d242c commit 59c3504
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 2 deletions.
43 changes: 43 additions & 0 deletions Box.V2.Test.Integration/BoxCollaborationsManagerTestIntegration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,49 @@ public async Task CollaborationsOnFolderWorkflow_LiveSession_ValidResponse()
Assert.IsTrue(success, "Collaboration deletion was unsucessful");
}

// Test to add collaboration by Box User ID and Box Group ID.
[TestMethod]
public async Task AddGroupCollaboration_File_Fields_ValidResponse()
{
const string fileId = "238288183114";
const string groupId = "176708848";
const string userId = "349294186";

// Add Group Collaboration
BoxCollaborationRequest addGroupRequest = new BoxCollaborationRequest()
{
Item = new BoxRequestEntity()
{
Id = fileId,
Type = BoxType.file
},
AccessibleBy = new BoxCollaborationUserRequest()
{
Type = BoxType.group,
Id = groupId
},
Role = "viewer"
};

//Add User Collaboration
BoxCollaborationRequest addUserRequest = new BoxCollaborationRequest()
{
Item = new BoxRequestEntity()
{
Id = fileId,
Type = BoxType.file
},
AccessibleBy = new BoxCollaborationUserRequest()
{
Type = BoxType.user,
Id = userId
},
Role = "editor"
};
var groupFileCollaboration = await _client.CollaborationsManager.AddCollaborationAsync(addGroupRequest, notify: false);
var userFileCollaboration = await _client.CollaborationsManager.AddCollaborationAsync(addUserRequest, notify: false);
}

[TestMethod]
public async Task CollaborationsOnFileWorkflow_LiveSession_ValidResponse()
{
Expand Down
2 changes: 1 addition & 1 deletion Box.V2/Managers/BoxCollaborationsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public BoxCollaborationsManager(IBoxConfig config, IBoxService service, IBoxConv
: base(config, service, converter, auth, asUser, suppressNotifications) { }

/// <summary>
/// Used to add a collaboration for a single user or a single group to a folder.
/// Used to add a collaboration for a single user or a single group to a folder or file.
/// Either an email address, a user ID, or a group id can be used to create the collaboration.
/// If the collaboration is being created with a group, access to this endpoint is granted based on the group's invitability_level.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion Box.V2/Models/Request/BoxCollaborationRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class BoxCollaborationRequest : BoxRequestEntity
{
/// <summary>
/// The item to add the collaboration on
/// The ID and Type are required. The Type MUST also be folder
/// The ID and Type are required. The Type can be folder or file.
/// </summary>
[JsonProperty(PropertyName = "item")]
public BoxRequestEntity Item { get; set; }
Expand Down

0 comments on commit 59c3504

Please sign in to comment.