dev
リビジョン | 37c4cd1882bec0733af1a201271291c03067991c (tree) |
---|---|
日時 | 2013-06-11 01:29:10 |
作者 | Kimura Youichi <kim.upsilon@bucy...> |
コミッター | Kimura Youichi |
テストケース壊しまくってたので修正
@@ -83,7 +83,7 @@ namespace OpenTween.Api | ||
83 | 83 | [TestCaseSource("ParseRateLimit_TestCase")] |
84 | 84 | public void ParseRateLimitTest(IDictionary<string, string> header, ApiLimit expect) |
85 | 85 | { |
86 | - var limit = TwitterApiStatus.ParseRateLimit(header, "X-RateLimit"); | |
86 | + var limit = TwitterApiStatus.ParseRateLimit(header, "X-RateLimit-"); | |
87 | 87 | Assert.That(limit, Is.EqualTo(expect)); |
88 | 88 | } |
89 | 89 |
@@ -65,21 +65,39 @@ namespace OpenTween | ||
65 | 65 | { |
66 | 66 | // toolStrip.ApiLimit の初期値は null |
67 | 67 | |
68 | - Assert.That(toolStrip.Text, Is.EqualTo("API ???/???")); | |
68 | + Assert.That(toolStrip.Text, Is.EqualTo("API v1.1 ???/???")); | |
69 | 69 | Assert.That(toolStrip.ToolTipText, Is.EqualTo("API rest ???/???" + Environment.NewLine + "(reset after ??? minutes)")); |
70 | 70 | |
71 | - toolStrip.ApiLimit = new ApiLimit(150, 100, DateTime.Now.AddMinutes(10)); | |
71 | + toolStrip.ApiLimit = new ApiLimit(15, 14, DateTime.Now.AddMinutes(15)); | |
72 | 72 | |
73 | - Assert.That(toolStrip.Text, Is.EqualTo("API 100/150")); | |
74 | - Assert.That(toolStrip.ToolTipText, Is.EqualTo("API rest 100/150" + Environment.NewLine + "(reset after 10 minutes)")); | |
73 | + Assert.That(toolStrip.Text, Is.EqualTo("API v1.1 14/15")); | |
74 | + Assert.That(toolStrip.ToolTipText, Is.EqualTo("API rest 14/15" + Environment.NewLine + "(reset after 15 minutes)")); | |
75 | 75 | |
76 | 76 | toolStrip.ApiLimit = null; |
77 | 77 | |
78 | - Assert.That(toolStrip.Text, Is.EqualTo("API ???/???")); | |
78 | + Assert.That(toolStrip.Text, Is.EqualTo("API v1.1 ???/???")); | |
79 | 79 | Assert.That(toolStrip.ToolTipText, Is.EqualTo("API rest ???/???" + Environment.NewLine + "(reset after ??? minutes)")); |
80 | 80 | } |
81 | 81 | } |
82 | 82 | |
83 | + [Test] | |
84 | + public void API11EnabledTest() | |
85 | + { | |
86 | + using (var toolStrip = new ToolStripAPIGauge()) | |
87 | + { | |
88 | + // toolStrip.API11Enabled の初期値は true | |
89 | + Assert.That(toolStrip.Text, Is.EqualTo("API v1.1 ???/???")); | |
90 | + | |
91 | + toolStrip.API11Enabled = false; | |
92 | + | |
93 | + Assert.That(toolStrip.Text, Is.EqualTo("API v1 ???/???")); | |
94 | + | |
95 | + toolStrip.API11Enabled = true; | |
96 | + | |
97 | + Assert.That(toolStrip.Text, Is.EqualTo("API v1.1 ???/???")); | |
98 | + } | |
99 | + } | |
100 | + | |
83 | 101 | class TestToolStripAPIGauge : ToolStripAPIGauge |
84 | 102 | { |
85 | 103 | public DateTime Now { get; set; } // 現在時刻 |