Skip to content

Commit 52609b6

Browse files
committed
new unit tests
1 parent d3150db commit 52609b6

1 file changed

Lines changed: 13 additions & 7 deletions

File tree

Clocks.Tests/ClockIn24HTests.cs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -150,25 +150,31 @@ public void AddSecondAddsSecond(int seconds, int expectedHour, int expectedMinut
150150
clock.Second.Should().Be(expectedSecond);
151151
}
152152

153-
[Fact]
154-
public void AddMinuteRollsHour()
153+
[Theory]
154+
[InlineData(30,2,0)]
155+
[InlineData(31,2,1)]
156+
[InlineData(95,3,5)]
157+
public void AddMinuteRollsHour(int minutes, int expectedHour, int expectedMinute)
155158
{
156159
var clock = new ClockIn24H(1,30, 0);
157160
clock.Hour.Should().Be(1);
158161
clock.Minute.Should().Be(30);
159162
clock.Second.Should().Be(0);
160163
clock.Invariant.Should().BeTrue();
161164

162-
clock.AddMinutes(30);
165+
clock.AddMinutes(minutes);
163166

164167
clock.Invariant.Should().BeTrue();
165-
clock.Hour.Should().Be(2);
166-
clock.Minute.Should().Be(0);
168+
clock.Hour.Should().Be(expectedHour);
169+
clock.Minute.Should().Be(expectedMinute);
167170
clock.Second.Should().Be(0);
168171
}
169172

170-
[Fact]
171-
public void AddSecondsRollsMinuteAndHour()
173+
[Theory]
174+
[InlineData(1,1,0,0)]
175+
[InlineData(61,1,1,0)]
176+
[InlineData(12345,4,25,44)]
177+
public void AddSecondsRollsMinuteAndHour(int seconds, int expectedHour, int expectedMinute, int expecedSecond)
172178
{
173179
var clock = new ClockIn24H(0,59, 59);
174180
clock.Hour.Should().Be(0);

0 commit comments

Comments
 (0)