test: cover core bot and web scenarios
This commit is contained in:
+36
@@ -0,0 +1,36 @@
|
||||
using GmRelay.Bot.Features.Sessions.RescheduleSession;
|
||||
|
||||
namespace GmRelay.Bot.Tests.Features.Sessions.RescheduleSession;
|
||||
|
||||
public sealed class RescheduleVoteRulesTests
|
||||
{
|
||||
[Fact]
|
||||
public void Evaluate_ShouldReject_WhenParticipantVotesNo()
|
||||
{
|
||||
var decision = RescheduleVoteRules.Evaluate("no", totalParticipants: 4, approvedParticipants: 3);
|
||||
|
||||
Assert.Equal(RescheduleVoteOutcome.Rejected, decision.Outcome);
|
||||
Assert.False(decision.ShouldRescheduleSession);
|
||||
Assert.Equal("Вы проголосовали против переноса.", decision.CallbackText);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Evaluate_ShouldApprove_WhenEveryoneVotedYes()
|
||||
{
|
||||
var decision = RescheduleVoteRules.Evaluate("yes", totalParticipants: 3, approvedParticipants: 3);
|
||||
|
||||
Assert.Equal(RescheduleVoteOutcome.Approved, decision.Outcome);
|
||||
Assert.True(decision.ShouldRescheduleSession);
|
||||
Assert.True(decision.ShouldResetParticipantRsvps);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Evaluate_ShouldStayPending_WhileVotesOutstanding()
|
||||
{
|
||||
var decision = RescheduleVoteRules.Evaluate("yes", totalParticipants: 5, approvedParticipants: 2);
|
||||
|
||||
Assert.Equal(RescheduleVoteOutcome.Pending, decision.Outcome);
|
||||
Assert.False(decision.ShouldRescheduleSession);
|
||||
Assert.False(decision.ShouldResetParticipantRsvps);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user