added new unit tests

This commit is contained in:
aedampir@gmail.com
2016-06-16 16:45:48 +07:00
parent 559d78b614
commit 7ce724cf6d
4 changed files with 418 additions and 2 deletions
@@ -22,6 +22,17 @@ namespace Octokit.Reactive
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get",
Justification = "Method makes a network request")]
IObservable<Milestone> Get(string owner, string name, int number);
/// <summary>
/// Gets a single Milestone by number.
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/issues/milestones/#get-a-single-milestone
/// </remarks>
/// <returns></returns>
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get",
Justification = "Method makes a network request")]
IObservable<Milestone> Get(int repositoryId, int number);
/// <summary>
/// Gets all open milestones for the repository.
@@ -33,6 +44,16 @@ namespace Octokit.Reactive
/// <param name="name">The name of the repository</param>
/// <returns></returns>
IObservable<Milestone> GetAllForRepository(string owner, string name);
/// <summary>
/// Gets all open milestones for the repository.
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/issues/milestones/#list-milestones-for-a-repository
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <returns></returns>
IObservable<Milestone> GetAllForRepository(int repositoryId);
/// <summary>
/// Gets all open milestones for the repository.
@@ -46,6 +67,17 @@ namespace Octokit.Reactive
/// <returns></returns>
IObservable<Milestone> GetAllForRepository(string owner, string name, ApiOptions options);
/// <summary>
/// Gets all open milestones for the repository.
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/issues/milestones/#list-milestones-for-a-repository
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="options">Options for changing the API response</param>
/// <returns></returns>
IObservable<Milestone> GetAllForRepository(int repositoryId, ApiOptions options);
/// <summary>
/// Gets all open milestones for the repository.
/// </summary>
@@ -58,6 +90,17 @@ namespace Octokit.Reactive
/// <returns></returns>
IObservable<Milestone> GetAllForRepository(string owner, string name, MilestoneRequest request);
/// <summary>
/// Gets all open milestones for the repository.
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/issues/milestones/#list-milestones-for-a-repository
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="request">Used to filter and sort the list of Milestones returned</param>
/// <returns></returns>
IObservable<Milestone> GetAllForRepository(int repositoryId, MilestoneRequest request);
/// <summary>
/// Gets all open milestones for the repository.
/// </summary>
@@ -71,6 +114,18 @@ namespace Octokit.Reactive
/// <returns></returns>
IObservable<Milestone> GetAllForRepository(string owner, string name, MilestoneRequest request, ApiOptions options);
/// <summary>
/// Gets all open milestones for the repository.
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/issues/milestones/#list-milestones-for-a-repository
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="request">Used to filter and sort the list of Milestones returned</param>
/// <param name="options">Options for changing the API response</param>
/// <returns></returns>
IObservable<Milestone> GetAllForRepository(int repositoryId, MilestoneRequest request, ApiOptions options);
/// <summary>
/// Creates a milestone for the specified repository. Any user with pull access to a repository can create a
/// Milestone.
@@ -82,6 +137,16 @@ namespace Octokit.Reactive
/// <returns></returns>
IObservable<Milestone> Create(string owner, string name, NewMilestone newMilestone);
/// <summary>
/// Creates a milestone for the specified repository. Any user with pull access to a repository can create a
/// Milestone.
/// </summary>
/// <remarks>http://developer.github.com/v3/issues/milestones/#create-a-milestone</remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="newMilestone">A <see cref="NewMilestone"/> instance describing the new Milestone to create</param>
/// <returns></returns>
IObservable<Milestone> Create(int repositoryId, NewMilestone newMilestone);
/// <summary>
/// Updates a milestone for the specified repository. Any user with pull access to a repository can create a
/// Milestone.
@@ -95,6 +160,18 @@ namespace Octokit.Reactive
/// <returns></returns>
IObservable<Milestone> Update(string owner, string name, int number, MilestoneUpdate milestoneUpdate);
/// <summary>
/// Updates a milestone for the specified repository. Any user with pull access to a repository can create a
/// Milestone.
/// </summary>
/// <remarks>http://developer.github.com/v3/issues/milestones/#update-a-milestone</remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="number">The Milestone number</param>
/// <param name="milestoneUpdate">An <see cref="MilestoneUpdate"/> instance describing the changes to make to the Milestone
/// </param>
/// <returns></returns>
IObservable<Milestone> Update(int repositoryId, int number, MilestoneUpdate milestoneUpdate);
/// <summary>
/// Deletes a milestone for the specified repository. Any user with pull access to a repository can create an
/// Milestone.
@@ -105,5 +182,15 @@ namespace Octokit.Reactive
/// <param name="number">The milestone number</param>
/// <returns></returns>
IObservable<Unit> Delete(string owner, string name, int number);
/// <summary>
/// Deletes a milestone for the specified repository. Any user with pull access to a repository can create an
/// Milestone.
/// </summary>
/// <remarks>http://developer.github.com/v3/issues/milestones/#delete-a-milestone</remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="number">The milestone number</param>
/// <returns></returns>
IObservable<Unit> Delete(int repositoryId, int number);
}
}
@@ -39,6 +39,18 @@ namespace Octokit.Reactive
return _client.Get(owner, name, number).ToObservable();
}
/// <summary>
/// Gets a single Milestone by number.
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/issues/milestones/#get-a-single-milestone
/// </remarks>
/// <returns></returns>
public IObservable<Milestone> Get(int repositoryId, int number)
{
return _client.Get(repositoryId, number).ToObservable();
}
/// <summary>
/// Gets all open milestones for the repository.
/// </summary>
@@ -56,6 +68,19 @@ namespace Octokit.Reactive
return GetAllForRepository(owner, name, ApiOptions.None);
}
/// <summary>
/// Gets all open milestones for the repository.
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/issues/milestones/#list-milestones-for-a-repository
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <returns></returns>
public IObservable<Milestone> GetAllForRepository(int repositoryId)
{
return GetAllForRepository(repositoryId, ApiOptions.None);
}
/// <summary>
/// Gets all open milestones for the repository.
/// </summary>
@@ -75,6 +100,22 @@ namespace Octokit.Reactive
return _connection.GetAndFlattenAllPages<Milestone>(ApiUrls.Milestones(owner, name), options);
}
/// <summary>
/// Gets all open milestones for the repository.
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/issues/milestones/#list-milestones-for-a-repository
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="options">Options for changing the API response</param>
/// <returns></returns>
public IObservable<Milestone> GetAllForRepository(int repositoryId, ApiOptions options)
{
Ensure.ArgumentNotNull(options, "options");
return _connection.GetAndFlattenAllPages<Milestone>(ApiUrls.Milestones(repositoryId), options);
}
/// <summary>
/// Gets all open milestones for the repository.
/// </summary>
@@ -94,6 +135,22 @@ namespace Octokit.Reactive
return GetAllForRepository(owner, name, request, ApiOptions.None);
}
/// <summary>
/// Gets all open milestones for the repository.
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/issues/milestones/#list-milestones-for-a-repository
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="request">Used to filter and sort the list of Milestones returned</param>
/// <returns></returns>
public IObservable<Milestone> GetAllForRepository(int repositoryId, MilestoneRequest request)
{
Ensure.ArgumentNotNull(request, "request");
return GetAllForRepository(repositoryId, request, ApiOptions.None);
}
/// <summary>
/// Gets all open milestones for the repository.
/// </summary>
@@ -116,6 +173,25 @@ namespace Octokit.Reactive
request.ToParametersDictionary(), options);
}
/// <summary>
/// Gets all open milestones for the repository.
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/issues/milestones/#list-milestones-for-a-repository
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="request">Used to filter and sort the list of Milestones returned</param>
/// <param name="options">Options for changing the API response</param>
/// <returns></returns>
public IObservable<Milestone> GetAllForRepository(int repositoryId, MilestoneRequest request, ApiOptions options)
{
Ensure.ArgumentNotNull(request, "request");
Ensure.ArgumentNotNull(options, "options");
return _connection.GetAndFlattenAllPages<Milestone>(ApiUrls.Milestones(repositoryId),
request.ToParametersDictionary(), options);
}
/// <summary>
/// Creates a milestone for the specified repository. Any user with pull access to a repository can create a
/// Milestone.
@@ -134,6 +210,21 @@ namespace Octokit.Reactive
return _client.Create(owner, name, newMilestone).ToObservable();
}
/// <summary>
/// Creates a milestone for the specified repository. Any user with pull access to a repository can create a
/// Milestone.
/// </summary>
/// <remarks>http://developer.github.com/v3/issues/milestones/#create-a-milestone</remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="newMilestone">A <see cref="NewMilestone"/> instance describing the new Milestone to create</param>
/// <returns></returns>
public IObservable<Milestone> Create(int repositoryId, NewMilestone newMilestone)
{
Ensure.ArgumentNotNull(newMilestone, "newMilestone");
return _client.Create(repositoryId, newMilestone).ToObservable();
}
/// <summary>
/// Updates a milestone for the specified repository. Any user with pull access to a repository can create a
/// Milestone.
@@ -154,6 +245,23 @@ namespace Octokit.Reactive
return _client.Update(owner, name, number, milestoneUpdate).ToObservable();
}
/// <summary>
/// Updates a milestone for the specified repository. Any user with pull access to a repository can create a
/// Milestone.
/// </summary>
/// <remarks>http://developer.github.com/v3/issues/milestones/#update-a-milestone</remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="number">The Milestone number</param>
/// <param name="milestoneUpdate">An <see cref="MilestoneUpdate"/> instance describing the changes to make to the Milestone
/// </param>
/// <returns></returns>
public IObservable<Milestone> Update(int repositoryId, int number, MilestoneUpdate milestoneUpdate)
{
Ensure.ArgumentNotNull(milestoneUpdate, "milestoneUpdate");
return _client.Update(repositoryId, number, milestoneUpdate).ToObservable();
}
/// <summary>
/// Deletes a milestone for the specified repository. Any user with pull access to a repository can create an
/// Milestone.
@@ -170,5 +278,18 @@ namespace Octokit.Reactive
return _client.Delete(owner, name, number).ToObservable();
}
/// <summary>
/// Deletes a milestone for the specified repository. Any user with pull access to a repository can create an
/// Milestone.
/// </summary>
/// <remarks>http://developer.github.com/v3/issues/milestones/#delete-a-milestone</remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="number">The milestone number</param>
/// <returns></returns>
public IObservable<Unit> Delete(int repositoryId, int number)
{
return _client.Delete(repositoryId, number).ToObservable();
}
}
}
}
+88 -1
View File
@@ -20,9 +20,20 @@ namespace Octokit
/// </remarks>
/// <returns></returns>
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get",
Justification = "Method makes a network request")]
Justification = "Method makes a network request")]
Task<Milestone> Get(string owner, string name, int number);
/// <summary>
/// Gets a single Milestone by number.
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/issues/milestones/#get-a-single-milestone
/// </remarks>
/// <returns></returns>
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get",
Justification = "Method makes a network request")]
Task<Milestone> Get(int repositoryId, int number);
/// <summary>
/// Gets all open milestones for the repository.
/// </summary>
@@ -34,6 +45,16 @@ namespace Octokit
/// <returns></returns>
Task<IReadOnlyList<Milestone>> GetAllForRepository(string owner, string name);
/// <summary>
/// Gets all open milestones for the repository.
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/issues/milestones/#list-milestones-for-a-repository
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <returns></returns>
Task<IReadOnlyList<Milestone>> GetAllForRepository(int repositoryId);
/// <summary>
/// Gets all open milestones for the repository.
/// </summary>
@@ -46,6 +67,17 @@ namespace Octokit
/// <returns></returns>
Task<IReadOnlyList<Milestone>> GetAllForRepository(string owner, string name, ApiOptions options);
/// <summary>
/// Gets all open milestones for the repository.
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/issues/milestones/#list-milestones-for-a-repository
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="options">Options for changing the API response</param>
/// <returns></returns>
Task<IReadOnlyList<Milestone>> GetAllForRepository(int repositoryId, ApiOptions options);
/// <summary>
/// Gets all open milestones for the repository.
/// </summary>
@@ -58,6 +90,17 @@ namespace Octokit
/// <returns></returns>
Task<IReadOnlyList<Milestone>> GetAllForRepository(string owner, string name, MilestoneRequest request);
/// <summary>
/// Gets all open milestones for the repository.
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/issues/milestones/#list-milestones-for-a-repository
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="request">Used to filter and sort the list of Milestones returned</param>
/// <returns></returns>
Task<IReadOnlyList<Milestone>> GetAllForRepository(int repositoryId, MilestoneRequest request);
/// <summary>
/// Gets all open milestones for the repository.
/// </summary>
@@ -71,6 +114,18 @@ namespace Octokit
/// <returns></returns>
Task<IReadOnlyList<Milestone>> GetAllForRepository(string owner, string name, MilestoneRequest request, ApiOptions options);
/// <summary>
/// Gets all open milestones for the repository.
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/issues/milestones/#list-milestones-for-a-repository
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="request">Used to filter and sort the list of Milestones returned</param>
/// <param name="options">Options for changing the API response</param>
/// <returns></returns>
Task<IReadOnlyList<Milestone>> GetAllForRepository(int repositoryId, MilestoneRequest request, ApiOptions options);
/// <summary>
/// Creates a milestone for the specified repository. Any user with pull access to a repository can create an
/// Milestone.
@@ -82,6 +137,16 @@ namespace Octokit
/// <returns></returns>
Task<Milestone> Create(string owner, string name, NewMilestone newMilestone);
/// <summary>
/// Creates a milestone for the specified repository. Any user with pull access to a repository can create an
/// Milestone.
/// </summary>
/// <remarks>http://developer.github.com/v3/issues/milestones/#create-a-milestone</remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="newMilestone">A <see cref="NewMilestone"/> instance describing the new Milestone to create</param>
/// <returns></returns>
Task<Milestone> Create(int repositoryId, NewMilestone newMilestone);
/// <summary>
/// Creates a milestone for the specified repository. Any user with pull access to a repository can create an
/// Milestone.
@@ -95,6 +160,18 @@ namespace Octokit
/// <returns></returns>
Task<Milestone> Update(string owner, string name, int number, MilestoneUpdate milestoneUpdate);
/// <summary>
/// Creates a milestone for the specified repository. Any user with pull access to a repository can create an
/// Milestone.
/// </summary>
/// <remarks>http://developer.github.com/v3/issues/milestones/#update-a-milestone</remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="number">The Milestone number</param>
/// <param name="milestoneUpdate">An <see cref="MilestoneUpdate"/> instance describing the changes to make to the Milestone
/// </param>
/// <returns></returns>
Task<Milestone> Update(int repositoryId, int number, MilestoneUpdate milestoneUpdate);
/// <summary>
/// Deletes a milestone for the specified repository. Any user with pull access to a repository can create an
/// Milestone.
@@ -105,5 +182,15 @@ namespace Octokit
/// <param name="number">The milestone number</param>
/// <returns></returns>
Task Delete(string owner, string name, int number);
/// <summary>
/// Deletes a milestone for the specified repository. Any user with pull access to a repository can create an
/// Milestone.
/// </summary>
/// <remarks>http://developer.github.com/v3/issues/milestones/#delete-a-milestone</remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="number">The milestone number</param>
/// <returns></returns>
Task Delete(int repositoryId, int number);
}
}
+121
View File
@@ -34,6 +34,18 @@ namespace Octokit
return ApiConnection.Get<Milestone>(ApiUrls.Milestone(owner, name, number));
}
/// <summary>
/// Gets a single Milestone by number.
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/issues/milestones/#get-a-single-milestone
/// </remarks>
/// <returns></returns>
public Task<Milestone> Get(int repositoryId, int number)
{
return ApiConnection.Get<Milestone>(ApiUrls.Milestone(repositoryId, number));
}
/// <summary>
/// Gets all open milestones for the repository.
/// </summary>
@@ -51,6 +63,19 @@ namespace Octokit
return GetAllForRepository(owner, name, new MilestoneRequest());
}
/// <summary>
/// Gets all open milestones for the repository.
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/issues/milestones/#list-milestones-for-a-repository
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <returns></returns>
public Task<IReadOnlyList<Milestone>> GetAllForRepository(int repositoryId)
{
return GetAllForRepository(repositoryId, new MilestoneRequest());
}
/// <summary>
/// Gets all open milestones for the repository.
/// </summary>
@@ -70,6 +95,22 @@ namespace Octokit
return GetAllForRepository(owner, name, new MilestoneRequest(), options);
}
/// <summary>
/// Gets all open milestones for the repository.
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/issues/milestones/#list-milestones-for-a-repository
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="options">Options for changing the API response</param>
/// <returns></returns>
public Task<IReadOnlyList<Milestone>> GetAllForRepository(int repositoryId, ApiOptions options)
{
Ensure.ArgumentNotNull(options, "options");
return GetAllForRepository(repositoryId, new MilestoneRequest(), options);
}
/// <summary>
/// Gets all open milestones for the repository.
/// </summary>
@@ -89,6 +130,22 @@ namespace Octokit
return GetAllForRepository(owner, name, request, ApiOptions.None);
}
/// <summary>
/// Gets all open milestones for the repository.
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/issues/milestones/#list-milestones-for-a-repository
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="request">Used to filter and sort the list of Milestones returned</param>
/// <returns></returns>
public Task<IReadOnlyList<Milestone>> GetAllForRepository(int repositoryId, MilestoneRequest request)
{
Ensure.ArgumentNotNull(request, "request");
return GetAllForRepository(repositoryId, request, ApiOptions.None);
}
/// <summary>
/// Gets all open milestones for the repository.
/// </summary>
@@ -111,6 +168,25 @@ namespace Octokit
request.ToParametersDictionary(), options);
}
/// <summary>
/// Gets all open milestones for the repository.
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/issues/milestones/#list-milestones-for-a-repository
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="request">Used to filter and sort the list of Milestones returned</param>
/// <param name="options">Options for changing the API response</param>
/// <returns></returns>
public Task<IReadOnlyList<Milestone>> GetAllForRepository(int repositoryId, MilestoneRequest request, ApiOptions options)
{
Ensure.ArgumentNotNull(request, "request");
Ensure.ArgumentNotNull(options, "options");
return ApiConnection.GetAll<Milestone>(ApiUrls.Milestones(repositoryId),
request.ToParametersDictionary(), options);
}
/// <summary>
/// Creates a milestone for the specified repository. Any user with pull access to a repository can create an
/// Milestone.
@@ -129,6 +205,21 @@ namespace Octokit
return ApiConnection.Post<Milestone>(ApiUrls.Milestones(owner, name), newMilestone);
}
/// <summary>
/// Creates a milestone for the specified repository. Any user with pull access to a repository can create an
/// Milestone.
/// </summary>
/// <remarks>http://developer.github.com/v3/issues/milestones/#create-a-milestone</remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="newMilestone">A <see cref="NewMilestone"/> instance describing the new Milestone to create</param>
/// <returns></returns>
public Task<Milestone> Create(int repositoryId, NewMilestone newMilestone)
{
Ensure.ArgumentNotNull(newMilestone, "newMilestone");
return ApiConnection.Post<Milestone>(ApiUrls.Milestones(repositoryId), newMilestone);
}
/// <summary>
/// Creates a milestone for the specified repository. Any user with pull access to a repository can create an
/// Milestone.
@@ -149,6 +240,23 @@ namespace Octokit
return ApiConnection.Patch<Milestone>(ApiUrls.Milestone(owner, name, number), milestoneUpdate);
}
/// <summary>
/// Creates a milestone for the specified repository. Any user with pull access to a repository can create an
/// Milestone.
/// </summary>
/// <remarks>http://developer.github.com/v3/issues/milestones/#update-a-milestone</remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="number">The Milestone number</param>
/// <param name="milestoneUpdate">An <see cref="MilestoneUpdate"/> instance describing the changes to make to the Milestone
/// </param>
/// <returns></returns>
public Task<Milestone> Update(int repositoryId, int number, MilestoneUpdate milestoneUpdate)
{
Ensure.ArgumentNotNull(milestoneUpdate, "milestoneUpdate");
return ApiConnection.Patch<Milestone>(ApiUrls.Milestone(repositoryId, number), milestoneUpdate);
}
/// <summary>
/// Deletes a milestone for the specified repository. Any user with pull access to a repository can create an
/// Milestone.
@@ -165,5 +273,18 @@ namespace Octokit
return ApiConnection.Delete(ApiUrls.Milestone(owner, name, number));
}
/// <summary>
/// Deletes a milestone for the specified repository. Any user with pull access to a repository can create an
/// Milestone.
/// </summary>
/// <remarks>http://developer.github.com/v3/issues/milestones/#delete-a-milestone</remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="number">The milestone number</param>
/// <returns></returns>
public Task Delete(int repositoryId, int number)
{
return ApiConnection.Delete(ApiUrls.Milestone(repositoryId, number));
}
}
}