51 lines
1.6 KiB
C#
51 lines
1.6 KiB
C#
using GmRelay.Bot.Features.Confirmation.HandleRsvp;
|
|
using GmRelay.Shared.Domain;
|
|
|
|
namespace GmRelay.Bot.Tests.Features.Confirmation.HandleRsvp;
|
|
|
|
public sealed class RsvpFlowRulesTests
|
|
{
|
|
[Fact]
|
|
public void Evaluate_ShouldRevertAndAlert_WhenConfirmedSessionGetsDecline()
|
|
{
|
|
var decision = RsvpFlowRules.Evaluate(
|
|
RsvpStatus.Declined,
|
|
SessionStatus.Confirmed,
|
|
totalParticipants: 3,
|
|
confirmedParticipants: 2);
|
|
|
|
Assert.True(decision.ShouldAlertGm);
|
|
Assert.True(decision.ShouldRevertSessionToConfirmationSent);
|
|
Assert.False(decision.ShouldMarkSessionConfirmed);
|
|
Assert.Equal("Вы отказались от участия.", decision.CallbackText);
|
|
}
|
|
|
|
[Fact]
|
|
public void Evaluate_ShouldMarkConfirmed_WhenLastParticipantConfirms()
|
|
{
|
|
var decision = RsvpFlowRules.Evaluate(
|
|
RsvpStatus.Confirmed,
|
|
SessionStatus.ConfirmationSent,
|
|
totalParticipants: 3,
|
|
confirmedParticipants: 3);
|
|
|
|
Assert.True(decision.ShouldMarkSessionConfirmed);
|
|
Assert.True(decision.ShouldNotifyGroup);
|
|
Assert.True(decision.ShouldNotifyGm);
|
|
}
|
|
|
|
[Fact]
|
|
public void Evaluate_ShouldKeepWaiting_WhenNotEveryoneConfirmed()
|
|
{
|
|
var decision = RsvpFlowRules.Evaluate(
|
|
RsvpStatus.Confirmed,
|
|
SessionStatus.ConfirmationSent,
|
|
totalParticipants: 4,
|
|
confirmedParticipants: 2);
|
|
|
|
Assert.False(decision.ShouldMarkSessionConfirmed);
|
|
Assert.False(decision.ShouldNotifyGroup);
|
|
Assert.False(decision.ShouldNotifyGm);
|
|
}
|
|
}
|