Files
octokit.net/Octokit.Tests.Integration/Helpers/TeamContext.cs
Henrik Andersson 7c170213fd List pending organization / team invitations (#1640)
* Add methods for listing pending organization invites

* Add unit/integration tests

* Add methods for getting all pending invites for a team

* Add unit/integration tests

* 🔥 whitespace 🔥

* Move new enum to it's own correct file and location

* Invite(s) -> Invitation(s)

* Add helper functions for adding invitations and cleaning the invitations up at the end of the test

* Add methods with ApiOptions

* Fix helper methods for adding/removing invitations

* Forgot to actually pass in the ApiOptions to the API call

* Add tests for new ApiOptions methods

* tweak integration tests

* Update outside collaborator tests to use [OrganizationTest] attribute for consistency

* Update test accounts used

* use octokitnet-test2 account now it has 2FA turned on
2017-08-14 16:52:53 +10:00

41 lines
1.1 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Octokit.Tests.Integration.Helpers
{
internal sealed class TeamContext : IDisposable
{
internal TeamContext(IConnection connection, Team team)
{
_connection = connection;
Team = team;
TeamId = team.Id;
TeamName = team.Name;
Invitations = new List<string>();
}
private IConnection _connection;
internal int TeamId { get; private set; }
internal string TeamName { get; private set; }
internal Team Team { get; private set; }
internal List<string> Invitations { get; private set; }
public void InviteMember(string login)
{
Invitations.Add(Helper.InviteMemberToTeam(_connection, TeamId, login));
}
public void Dispose()
{
if (Invitations.Any())
Helper.DeleteInvitations(_connection, Invitations, TeamId);
Helper.DeleteTeam(_connection, Team);
}
}
}