mirror of
https://github.com/zoriya/octokit.net.git
synced 2025-12-06 07:16:09 +00:00
* Added visibility field to EmailAddress response model * quote private in comment to indicate string value * Create EmailVisibility enum; change visibility to be StringEnum<EmailVisibility> * Change EmailVisibility to be nullable, remove null option from enum * Fixed closing tag on Visibility property summary * unskip email integration test as it seems to work now
64 lines
1.7 KiB
C#
64 lines
1.7 KiB
C#
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using Xunit;
|
|
|
|
namespace Octokit.Tests.Integration.Clients
|
|
{
|
|
public class UserEmailsClientTests
|
|
{
|
|
private readonly IUserEmailsClient _emailClient;
|
|
|
|
public UserEmailsClientTests()
|
|
{
|
|
var github = Helper.GetAuthenticatedClient();
|
|
_emailClient = github.User.Email;
|
|
}
|
|
|
|
[IntegrationTest]
|
|
public async Task CanGetEmail()
|
|
{
|
|
var emails = await _emailClient.GetAll();
|
|
Assert.NotEmpty(emails);
|
|
}
|
|
|
|
[IntegrationTest]
|
|
public async Task CanGetEmailWithApiOptions()
|
|
{
|
|
var emails = await _emailClient.GetAll(ApiOptions.None);
|
|
Assert.NotEmpty(emails);
|
|
}
|
|
|
|
[IntegrationTest]
|
|
public async Task ReturnsCorrectCountOfEmailsWithoutStart()
|
|
{
|
|
var options = new ApiOptions
|
|
{
|
|
PageSize = 5,
|
|
PageCount = 1
|
|
};
|
|
|
|
var emails = await _emailClient.GetAll(options);
|
|
|
|
Assert.NotEmpty(emails);
|
|
}
|
|
|
|
const string testEmailAddress = "hahaha-not-a-real-email@foo.com";
|
|
|
|
[IntegrationTest]
|
|
public async Task CanAddAndDeleteEmail()
|
|
{
|
|
var github = Helper.GetAuthenticatedClient();
|
|
|
|
await github.User.Email.Add(testEmailAddress);
|
|
|
|
var emails = await github.User.Email.GetAll();
|
|
Assert.Contains(testEmailAddress, emails.Select(x => x.Email));
|
|
|
|
await github.User.Email.Delete(testEmailAddress);
|
|
|
|
emails = await github.User.Email.GetAll();
|
|
Assert.DoesNotContain(testEmailAddress, emails.Select(x => x.Email));
|
|
}
|
|
}
|
|
}
|