mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-05-30 09:49:04 +00:00
Additional changes following review
This commit is contained in:
@@ -80,14 +80,7 @@ public class MiscellaneousClientTests
|
||||
|
||||
var result = await github.Miscellaneous.GetRateLimits();
|
||||
|
||||
// Test the high level object
|
||||
Assert.NotNull(result);
|
||||
|
||||
// Test the resources level
|
||||
Assert.NotNull(result.Resources);
|
||||
|
||||
// Test the core limits
|
||||
Assert.NotNull(result.Resources.Core);
|
||||
Assert.True(result.Resources.Core.Limit > 0);
|
||||
Assert.True(result.Resources.Core.Remaining > -1);
|
||||
Assert.True(result.Resources.Core.Remaining <= result.Resources.Core.Limit);
|
||||
@@ -95,7 +88,6 @@ public class MiscellaneousClientTests
|
||||
Assert.NotNull(result.Resources.Core.Reset);
|
||||
|
||||
// Test the search limits
|
||||
Assert.NotNull(result.Resources.Search);
|
||||
Assert.True(result.Resources.Search.Limit > 0);
|
||||
Assert.True(result.Resources.Search.Remaining > -1);
|
||||
Assert.True(result.Resources.Search.Remaining <= result.Resources.Search.Limit);
|
||||
@@ -103,7 +95,6 @@ public class MiscellaneousClientTests
|
||||
Assert.NotNull(result.Resources.Search.Reset);
|
||||
|
||||
// Test the depreciated rate limits
|
||||
Assert.NotNull(result.Rate);
|
||||
Assert.True(result.Rate.Limit > 0);
|
||||
Assert.True(result.Rate.Remaining > -1);
|
||||
Assert.True(result.Rate.Remaining <= result.Rate.Limit);
|
||||
|
||||
@@ -81,14 +81,7 @@ namespace Octokit.Tests.Clients
|
||||
|
||||
var result = await client.GetRateLimits();
|
||||
|
||||
// Test the high level object
|
||||
Assert.NotNull(result);
|
||||
|
||||
// Test the resource object
|
||||
Assert.NotNull(result.Resources);
|
||||
|
||||
// Test the core limits
|
||||
Assert.NotNull(result.Resources.Core);
|
||||
Assert.Equal(5000, result.Resources.Core.Limit);
|
||||
Assert.Equal(4999, result.Resources.Core.Remaining);
|
||||
Assert.Equal(1372700873, result.Resources.Core.ResetAsUtcEpochSeconds);
|
||||
@@ -99,7 +92,6 @@ namespace Octokit.Tests.Clients
|
||||
Assert.Equal(expectedReset, result.Resources.Core.Reset);
|
||||
|
||||
// Test the search limits
|
||||
Assert.NotNull(result.Resources.Search);
|
||||
Assert.Equal(30, result.Resources.Search.Limit);
|
||||
Assert.Equal(18, result.Resources.Search.Remaining);
|
||||
Assert.Equal(1372700873, result.Resources.Search.ResetAsUtcEpochSeconds);
|
||||
@@ -110,7 +102,6 @@ namespace Octokit.Tests.Clients
|
||||
Assert.Equal(expectedReset, result.Resources.Search.Reset);
|
||||
|
||||
// Test the depreciated rate limits
|
||||
Assert.NotNull(result.Rate);
|
||||
Assert.Equal(100, result.Rate.Limit);
|
||||
Assert.Equal(75, result.Rate.Remaining);
|
||||
Assert.Equal(1372700873, result.Rate.ResetAsUtcEpochSeconds);
|
||||
|
||||
@@ -10,8 +10,8 @@ namespace Octokit
|
||||
{
|
||||
#if !NETFX_CORE
|
||||
[Serializable]
|
||||
[DebuggerDisplay("{DebuggerDisplay,nq}")]
|
||||
#endif
|
||||
[DebuggerDisplay("{DebuggerDisplay,nq}")]
|
||||
public class RateLimit
|
||||
#if !NETFX_CORE
|
||||
: ISerializable
|
||||
@@ -52,18 +52,14 @@ namespace Octokit
|
||||
/// <summary>
|
||||
/// The date and time at which the current rate limit window resets
|
||||
/// </summary>
|
||||
#if !NETFX_CORE
|
||||
[ParameterAttribute(Key = "ignoreThisField")]
|
||||
#endif
|
||||
public DateTimeOffset Reset { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The date and time at which the current rate limit window resets - in UTC epoch seconds
|
||||
/// </summary>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
#if !NETFX_CORE
|
||||
[ParameterAttribute(Key = "reset")]
|
||||
#endif
|
||||
public long ResetAsUtcEpochSeconds { get { return Reset.ToUnixTime(); } private set { Reset = value.FromUnixTime(); } }
|
||||
|
||||
static long GetHeaderValueAsInt32Safe(IDictionary<string, string> responseHeaders, string key)
|
||||
@@ -95,11 +91,7 @@ namespace Octokit
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !NETFX_CORE
|
||||
internal string DebuggerDisplay
|
||||
#else
|
||||
public string DebuggerDisplay
|
||||
#endif
|
||||
{
|
||||
get
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user