public async Task EnsuresNonNullArguments() { var client = new OrganizationOutsideCollaboratorsClient(Substitute.For <IApiConnection>()); await Assert.ThrowsAsync <ArgumentNullException>(() => client.GetAll(null)); await Assert.ThrowsAsync <ArgumentNullException>(() => client.GetAll(null, ApiOptions.None)); await Assert.ThrowsAsync <ArgumentNullException>(() => client.GetAll("org", null)); await Assert.ThrowsAsync <ArgumentNullException>(() => client.GetAll(null, OrganizationMembersFilter.All)); await Assert.ThrowsAsync <ArgumentNullException>(() => client.GetAll(null, OrganizationMembersFilter.All, ApiOptions.None)); await Assert.ThrowsAsync <ArgumentNullException>(() => client.GetAll("org", OrganizationMembersFilter.All, null)); await Assert.ThrowsAsync <ArgumentException>(() => client.GetAll("")); await Assert.ThrowsAsync <ArgumentException>(() => client.GetAll("", ApiOptions.None)); await Assert.ThrowsAsync <ArgumentException>(() => client.GetAll("", OrganizationMembersFilter.All)); await Assert.ThrowsAsync <ArgumentException>(() => client.GetAll("", OrganizationMembersFilter.All, ApiOptions.None)); }
public void AllFilterRequestsTheCorrectUrl() { var connection = Substitute.For <IApiConnection>(); var client = new OrganizationOutsideCollaboratorsClient(connection); client.GetAll("org", OrganizationMembersFilter.All); connection.Received().GetAll <User>(Arg.Is <Uri>(u => u.ToString() == "orgs/org/outside_collaborators?filter=all"), null, "application/vnd.github.korra-preview+json", Args.ApiOptions); }
public void TwoFactorFilterRequestsTheCorrectUrl() { var connection = Substitute.For <IApiConnection>(); var client = new OrganizationOutsideCollaboratorsClient(connection); client.GetAll("org", OrganizationMembersFilter.TwoFactorAuthenticationDisabled); connection.Received().GetAll <User>(Arg.Is <Uri>(u => u.ToString() == "orgs/org/outside_collaborators?filter=2fa_disabled"), null, "application/vnd.github.korra-preview+json"); }
public void RequestsTheCorrectUrl() { var connection = Substitute.For <IApiConnection>(); var client = new OrganizationOutsideCollaboratorsClient(connection); client.ConvertFromMember("org", "user"); connection.Connection.Received().Put( Arg.Is <Uri>(u => u.ToString() == "orgs/org/outside_collaborators/user"), "application/vnd.github.korra-preview+json"); }
public async Task EnsuresNonNullArgument() { var client = new OrganizationOutsideCollaboratorsClient(Substitute.For <IApiConnection>()); await Assert.ThrowsAsync <ArgumentNullException>(() => client.ConvertFromMember(null, "user")); await Assert.ThrowsAsync <ArgumentNullException>(() => client.ConvertFromMember("org", null)); await Assert.ThrowsAsync <ArgumentException>(() => client.ConvertFromMember("", "user")); await Assert.ThrowsAsync <ArgumentException>(() => client.ConvertFromMember("org", "")); }
public void RequestsTheCorrectUrlWithApiOptions() { var connection = Substitute.For <IApiConnection>(); var client = new OrganizationOutsideCollaboratorsClient(connection); var options = new ApiOptions { PageCount = 1, PageSize = 1, StartPage = 1 }; client.GetAll("org", options); connection.Received().GetAll <User>(Arg.Is <Uri>(u => u.ToString() == "orgs/org/outside_collaborators"), null, "application/vnd.github.korra-preview+json", options); }