開発に使用するリポジトリ
Revision | bfa3997baa0ea9b57e5beb4607ebe0a8fd2fb174 (tree) |
---|---|
Time | 2020-03-13 05:31:05 |
Author | Kimura Youichi <kim.upsilon@bucy...> |
Commiter | Kimura Youichi |
ToolStripAPIGaugeでレートリミットが10億回/15分の場合のテストコードを追加
@@ -203,5 +203,32 @@ namespace OpenTween | ||
203 | 203 | MyCommon.TwitterApiInfo.AccessLimit.Clear(); |
204 | 204 | } |
205 | 205 | } |
206 | + | |
207 | + [Fact] | |
208 | + public void OneBillionTest() | |
209 | + { | |
210 | + using var toolStrip = new TestToolStripAPIGauge(); | |
211 | + | |
212 | + var now = new DateTimeUtc(2020, 2, 25, 19, 0, 0); | |
213 | + toolStrip.DateTimeNow = now; | |
214 | + | |
215 | + toolStrip.AutoSize = false; | |
216 | + toolStrip.Size = new Size(100, 10); | |
217 | + toolStrip.GaugeHeight = 5; | |
218 | + | |
219 | + MyCommon.TwitterApiInfo.AccessLimit["/statuses/user_timeline"] = new ApiLimit( | |
220 | + limitCount: 1_000_000_000, | |
221 | + limitRemain: 999_999_999, | |
222 | + resetDate: now + TimeSpan.FromMinutes(15) | |
223 | + ); | |
224 | + toolStrip.ApiEndpoint = "/statuses/user_timeline"; | |
225 | + | |
226 | + Assert.Equal(new Rectangle(0, 0, 99, 5), toolStrip.apiGaugeBounds); // 99% (999999999/1000000000) | |
227 | + Assert.Equal(new Rectangle(0, 5, 100, 5), toolStrip.timeGaugeBounds); // 100% (15/15) | |
228 | + Assert.Equal("API 999999999/1000000000", toolStrip.Text); | |
229 | + Assert.Equal("API rest /statuses/user_timeline 999999999/1000000000" + Environment.NewLine + "(reset after 15 minutes)", toolStrip.ToolTipText); | |
230 | + | |
231 | + MyCommon.TwitterApiInfo.AccessLimit.Clear(); | |
232 | + } | |
206 | 233 | } |
207 | 234 | } |