mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-07 20:30:41 +00:00
Add ObservableMilestoneClient int tests
This commit is contained in:
@@ -61,6 +61,7 @@
|
||||
<Compile Include="IntegrationTestAttribute.cs" />
|
||||
<Compile Include="IssuesClientTests.cs" />
|
||||
<Compile Include="MiscellaneousClientTests.cs" />
|
||||
<Compile Include="Reactive\ObservableMilestonesClientTests.cs" />
|
||||
<Compile Include="Reactive\ObservableRepositoriesClientTests.cs" />
|
||||
<Compile Include="ReleasesClientTests.cs" />
|
||||
<Compile Include="RepositoriesClientTests.cs" />
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
using System.Linq;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Reactive.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Octokit.Reactive.Clients;
|
||||
using Xunit;
|
||||
|
||||
namespace Octokit.Tests.Integration
|
||||
{
|
||||
public class ObservableMilestonesClientTests
|
||||
{
|
||||
public class TheGetMethod
|
||||
{
|
||||
[IntegrationTest]
|
||||
public async Task ReturnsSpecifiedMilestone()
|
||||
{
|
||||
var github = new GitHubClient(new ProductHeaderValue("OctokitTests"))
|
||||
{
|
||||
Credentials = Helper.Credentials
|
||||
};
|
||||
var client = new ObservableMilestonesClient(github);
|
||||
var observable = client.Get("libgit2", "libgit2sharp", 1);
|
||||
var milestone = await observable;
|
||||
|
||||
Assert.Equal(1, milestone.Number);
|
||||
Assert.Equal("v0.4.0", milestone.Title);
|
||||
Assert.Equal(7, milestone.ClosedIssues);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public void ReturnsAllMilestones()
|
||||
{
|
||||
var github = new GitHubClient(new ProductHeaderValue("OctokitTests"))
|
||||
{
|
||||
Credentials = Helper.Credentials
|
||||
};
|
||||
var client = new ObservableMilestonesClient(github);
|
||||
var milestones = client.GetForRepository("libgit2", "libgit2sharp", new MilestoneRequest { State = ItemState.Closed }).ToList().Wait();
|
||||
|
||||
Assert.NotEmpty(milestones);
|
||||
Assert.True(milestones.All(m => m.State == ItemState.Closed));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user