Chnage LastApiInfo to GetLastApiInfo with cloned version

This commit is contained in:
Mark Taylor
2015-08-16 21:27:26 +01:00
parent 5bd1f1d6c5
commit b2c7e1c2a7
13 changed files with 224 additions and 33 deletions
+20
View File
@@ -51,5 +51,25 @@ namespace Octokit
/// Information about the API rate limit
/// </summary>
public RateLimit RateLimit { get; private set; }
/// <summary>
/// Allows you to clone ApiInfo
/// </summary>
/// <returns>A clone of <seealso cref="ApiInfo"/></returns>
public ApiInfo Clone()
{
// Seem to have to do this to pass a whole bunch of tests (for example Octokit.Tests.Clients.EventsClientTests.DeserializesCommitCommentEventCorrectly)
// I believe this has something to do with the Mocking framework.
if (this == null || this.Links == null || this.OauthScopes == null || this.RateLimit == null || this.Etag == null)
return null;
return new ApiInfo(this.Links.Clone(),
this.OauthScopes.Clone(),
this.AcceptedOauthScopes.Clone(),
new String(this.Etag.ToCharArray()),
this.RateLimit.Clone());
}
}
}