Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: Allow moderators to increase the round time up to 60 minutes #107

Merged
merged 1 commit into from
Sep 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/Application/Maps/TimeLeft.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
/// </summary>
public class TimeLeft
{
private const int MaxRoundTime = 900;
private const int MaxRoundTime = 3600;
private const int DefaultRoundTime = 900;

/// <summary>
/// Represents the interval in seconds.
/// </summary>
private int _interval = MaxRoundTime;
private int _interval = DefaultRoundTime;

/// <summary>
/// Represents the time left in a text draw.
Expand Down Expand Up @@ -65,7 +67,7 @@ public void Decrease()

public void Reset()
{
_interval = MaxRoundTime;
_interval = DefaultRoundTime;
UpdateTextDraw();
}

Expand Down
34 changes: 20 additions & 14 deletions tests/Application.Tests/Maps/TimeLeftTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ public void IsCompleted_WhenTimeLeftIsNotCompleted_ShouldReturnsFalse()

[TestCase(-1)]
[TestCase(-2)]
[TestCase(16)]
[TestCase(17)]
[TestCase(61)]
[TestCase(62)]
public void SetInterval_WhenMinutesIntervalIsOutOfRange_ShouldReturnsFailureResult(int value)
{
// Arrange
Expand All @@ -73,6 +73,9 @@ public void SetInterval_WhenMinutesIntervalIsOutOfRange_ShouldReturnsFailureResu
[TestCase(12, "12:00")]
[TestCase(14, "14:00")]
[TestCase(15, "15:00")]
[TestCase(30, "30:00")]
[TestCase(45, "45:00")]
[TestCase(60, "60:00")]
public void SetInterval_WhenMinutesIntervalIsNotOutOfRange_ShouldReturnsSuccessResult(int value, string expectedText)
{
// Arrange
Expand All @@ -89,8 +92,8 @@ public void SetInterval_WhenMinutesIntervalIsNotOutOfRange_ShouldReturnsSuccessR

[TestCase(-1)]
[TestCase(-2)]
[TestCase(901)]
[TestCase(902)]
[TestCase(3601)]
[TestCase(3602)]
public void SetInterval_WhenSecondsIntervalIsOutOfRange_ShouldReturnsFailureResult(int value)
{
// Arrange
Expand All @@ -106,16 +109,19 @@ public void SetInterval_WhenSecondsIntervalIsOutOfRange_ShouldReturnsFailureResu
timeLeft.TextDraw.Should().Be(expectedText);
}

[TestCase(0, "00:00")]
[TestCase(1, "00:01")]
[TestCase(5, "00:05")]
[TestCase(60, "01:00")]
[TestCase(300, "05:00")]
[TestCase(428, "07:08")]
[TestCase(590, "09:50")]
[TestCase(608, "10:08")]
[TestCase(840, "14:00")]
[TestCase(900, "15:00")]
[TestCase(0, "00:00")]
[TestCase(1, "00:01")]
[TestCase(5, "00:05")]
[TestCase(60, "01:00")]
[TestCase(300, "05:00")]
[TestCase(428, "07:08")]
[TestCase(590, "09:50")]
[TestCase(608, "10:08")]
[TestCase(840, "14:00")]
[TestCase(900, "15:00")]
[TestCase(1800, "30:00")]
[TestCase(2700, "45:00")]
[TestCase(3600, "60:00")]
public void SetInterval_WhenSecondsIntervalIsNotOutOfRange_ShouldReturnsSuccessResult(int value, string expectedText)
{
// Arrange
Expand Down
Loading