feat: add a wait before a notice can be accepted
This commit is contained in:
@@ -143,6 +143,18 @@ public class NoticeRulesTests
|
||||
Assert.NotNull(NoticeRules.ValidateDraft(new NoticeDraft { Title = title }));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(-1, false)]
|
||||
[InlineData(0, true)]
|
||||
[InlineData(600, true)]
|
||||
[InlineData(601, false)]
|
||||
public void Draft_AcceptDelayHasToBeInRange(int seconds, bool valid)
|
||||
{
|
||||
var draft = new NoticeDraft { Title = "Hi", RequireAccept = true, AcceptDelaySeconds = seconds };
|
||||
|
||||
Assert.Equal(valid, NoticeRules.ValidateDraft(draft) is null);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Draft_SelectedUsersNeedAtLeastOneUser()
|
||||
{
|
||||
|
||||
@@ -30,6 +30,26 @@ public sealed class NoticeServiceTests : IDisposable
|
||||
return notice;
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AcceptDelay_IsStoredForMustAcceptNotices()
|
||||
{
|
||||
var created = Create("Terms", d =>
|
||||
{
|
||||
d.RequireAccept = true;
|
||||
d.AcceptDelaySeconds = 15;
|
||||
});
|
||||
|
||||
Assert.Equal(15, _service.Get(created.Id)!.AcceptDelaySeconds);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AcceptDelay_IsDroppedWithoutRequireAccept()
|
||||
{
|
||||
var created = Create("Info", d => d.AcceptDelaySeconds = 15);
|
||||
|
||||
Assert.Equal(0, _service.Get(created.Id)!.AcceptDelaySeconds);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Create_RoundTripsThroughTheDatabase()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user