diff --git a/Octokit.Reactive.nuspec b/Octokit.Reactive.nuspec
index 22e4db7e..ba8fdc70 100644
--- a/Octokit.Reactive.nuspec
+++ b/Octokit.Reactive.nuspec
@@ -8,7 +8,7 @@
@summary@
https://github.com/octokit/octokit.net/blob/master/LICENSE.txt
https://github.com/octokit/octokit.net
- https://f.cloud.github.com/assets/19977/1441274/160fba8c-41a9-11e3-831d-61d88fa886f4.png
+ https://f.cloud.github.com/assets/19977/1510987/64af2b26-4a9d-11e3-89fc-96a185171c75.png
false
@description@
@releaseNotes@
diff --git a/Octokit.Tests.Integration/ReleasesClientTests.cs b/Octokit.Tests.Integration/ReleasesClientTests.cs
index 788b91e0..ebe9c8a8 100644
--- a/Octokit.Tests.Integration/ReleasesClientTests.cs
+++ b/Octokit.Tests.Integration/ReleasesClientTests.cs
@@ -1,4 +1,5 @@
-using System.Linq;
+using System;
+using System.Linq;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Xunit;
@@ -7,17 +8,32 @@ namespace Octokit.Tests.Integration
{
public class ReleasesClientTests
{
- public class TheGetReleasesMethod
+ public class TheGetReleasesMethod : IDisposable
{
- [IntegrationTest]
- public async Task ReturnsReleases()
+ readonly IReleasesClient _releaseClient;
+ readonly Repository _repository;
+ readonly string _repositoryOwner;
+ readonly string _repositoryName;
+ readonly GitHubClient _github;
+
+ public TheGetReleasesMethod()
{
- var github = new GitHubClient(new ProductHeaderValue("OctokitTests"))
+ _github = new GitHubClient(new ProductHeaderValue("OctokitTests"))
{
Credentials = Helper.Credentials
};
+ _releaseClient = _github.Release;
- var releases = await github.Release.GetAll("git-tfs", "git-tfs");
+ var repoName = Helper.MakeNameWithTimestamp("public-repo");
+ _repository = _github.Repository.Create(new NewRepository { Name = repoName, AutoInit = true }).Result;
+ _repositoryOwner = _repository.Owner.Login;
+ _repositoryName = _repository.Name;
+ }
+
+ [IntegrationTest]
+ public async Task ReturnsReleases()
+ {
+ var releases = await _releaseClient.GetAll("git-tfs", "git-tfs");
Assert.True(releases.Count > 5);
Assert.True(releases.Any(release => release.TagName == "v0.18.0"));
@@ -26,16 +42,20 @@ namespace Octokit.Tests.Integration
[IntegrationTest]
public async Task ReturnsReleasesWithNullPublishDate()
{
- var github = new GitHubClient(new ProductHeaderValue("OctokitTests"))
- {
- Credentials = Helper.Credentials
- };
+ // create a release without a publish date
+ var releaseWithNoUpdate = new ReleaseUpdate("0.1") { Draft = true };
+ var release = _releaseClient.CreateRelease(_repositoryOwner, _repositoryName, releaseWithNoUpdate).Result;
- var releases = await github.Release.GetAll("Particular", "ServiceInsight");
+ var releases = await _releaseClient.GetAll(_repositoryOwner, _repositoryName);
Assert.True(releases.Count == 1);
Assert.False(releases.First().PublishedAt.HasValue);
}
+
+ public void Dispose()
+ {
+ Helper.DeleteRepo(_repository);
+ }
}
}
}
diff --git a/Octokit.Tests/Clients/StarredClientTests.cs b/Octokit.Tests/Clients/StarredClientTests.cs
new file mode 100644
index 00000000..7203f2fc
--- /dev/null
+++ b/Octokit.Tests/Clients/StarredClientTests.cs
@@ -0,0 +1,129 @@
+using Octokit.Internal;
+using System;
+using System.Net;
+using System.Threading.Tasks;
+using NSubstitute;
+using Xunit;
+using Xunit.Extensions;
+
+namespace Octokit.Tests.Clients
+{
+ public class StarredClientTests
+ {
+ public class TheGetAllForCurrentMethod
+ {
+ [Fact]
+ public void RequestsCorrectUrl()
+ {
+ var endpoint = new Uri("user/starred", UriKind.Relative);
+ var connection = Substitute.For();
+ var client = new StarredClient(connection);
+
+ client.GetAllForCurrent();
+
+ connection.Received().GetAll(endpoint);
+ }
+ }
+
+ public class TheGetAllForUserMethod
+ {
+ [Fact]
+ public void RequestsCorrectUrl()
+ {
+ var endpoint = new Uri("users/banana/starred", UriKind.Relative);
+ var connection = Substitute.For();
+ var client = new StarredClient(connection);
+
+ client.GetAllForUser("banana");
+
+ connection.Received().GetAll(endpoint);
+ }
+ }
+
+ public class TheGetAllStargazersForRepoMethod
+ {
+ [Fact]
+ public void RequestsCorrectUrl()
+ {
+ var endpoint = new Uri("repos/fight/club/stargazers", UriKind.Relative);
+ var connection = Substitute.For();
+ var client = new StarredClient(connection);
+
+ client.GetAllStargazers("fight", "club");
+
+ connection.Received().GetAll(endpoint);
+ }
+ }
+
+ public class TheCheckStarredMethod
+ {
+ [Theory]
+ [InlineData(HttpStatusCode.NoContent, true)]
+ [InlineData(HttpStatusCode.NotFound, false)]
+ public async Task ReturnsCorrectResultBasedOnStatus(HttpStatusCode status, bool expected)
+ {
+ var response = Task.Factory.StartNew>(() =>
+ new ApiResponse