LEFT | RIGHT |
1 /* | 1 /* |
2 Copyright 2013 Google Inc | 2 Copyright 2013 Google Inc |
3 | 3 |
4 Licensed under the Apache License, Version 2.0 (the "License"); | 4 Licensed under the Apache License, Version 2.0 (the "License"); |
5 you may not use this file except in compliance with the License. | 5 you may not use this file except in compliance with the License. |
6 You may obtain a copy of the License at | 6 You may obtain a copy of the License at |
7 | 7 |
8 http://www.apache.org/licenses/LICENSE-2.0 | 8 http://www.apache.org/licenses/LICENSE-2.0 |
9 | 9 |
10 Unless required by applicable law or agreed to in writing, software | 10 Unless required by applicable law or agreed to in writing, software |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 backOff.GetNextBackOff(-2); | 46 backOff.GetNextBackOff(-2); |
47 Assert.Fail(); | 47 Assert.Fail(); |
48 } | 48 } |
49 catch (ArgumentOutOfRangeException) { } | 49 catch (ArgumentOutOfRangeException) { } |
50 } | 50 } |
51 | 51 |
52 /// <summary>Tests constructor with invalid time span object (less then
0 or greater than 1sec).</summary> | 52 /// <summary>Tests constructor with invalid time span object (less then
0 or greater than 1sec).</summary> |
53 [Test] | 53 [Test] |
54 public void Constructor_InvalidValue() | 54 public void Constructor_InvalidValue() |
55 { | 55 { |
56 // invalid delta | 56 // Invalid delta. |
57 SubtestConstructor_InvalidValue(TimeSpan.FromMilliseconds(-1)); | 57 SubtestConstructor_InvalidValue(TimeSpan.FromMilliseconds(-1)); |
58 SubtestConstructor_InvalidValue(TimeSpan.FromDays(-1)); | 58 SubtestConstructor_InvalidValue(TimeSpan.FromDays(-1)); |
59 SubtestConstructor_InvalidValue(TimeSpan.FromMilliseconds(1001)); | 59 SubtestConstructor_InvalidValue(TimeSpan.FromMilliseconds(1001)); |
60 // invalid max | 60 // Invalid max. |
61 SubtestConstructor_InvalidValue(TimeSpan.FromMilliseconds(500), -1); | 61 SubtestConstructor_InvalidValue(TimeSpan.FromMilliseconds(500), -1); |
62 SubtestConstructor_InvalidValue(TimeSpan.FromMilliseconds(500), 21); | 62 SubtestConstructor_InvalidValue(TimeSpan.FromMilliseconds(500), 21); |
63 | 63 |
64 } | 64 } |
65 | 65 |
66 /// <summary>A helper subtest to test invalid value given to the constru
ctor.</summary> | 66 /// <summary>A helper subtest to test invalid value given to the constru
ctor.</summary> |
67 private void SubtestConstructor_InvalidValue(TimeSpan ts, int max = 10) | 67 private void SubtestConstructor_InvalidValue(TimeSpan ts, int max = 10) |
68 { | 68 { |
69 try | 69 try |
70 { | 70 { |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 Assert.AreNotEqual(TimeSpan.MinValue, backOff.GetNextBackOff
(i)); | 134 Assert.AreNotEqual(TimeSpan.MinValue, backOff.GetNextBackOff
(i)); |
135 } | 135 } |
136 else | 136 else |
137 { | 137 { |
138 Assert.AreEqual(TimeSpan.MinValue, backOff.GetNextBackOff(i)
); | 138 Assert.AreEqual(TimeSpan.MinValue, backOff.GetNextBackOff(i)
); |
139 } | 139 } |
140 } | 140 } |
141 } | 141 } |
142 } | 142 } |
143 } | 143 } |
LEFT | RIGHT |