27 lines
1.2 KiB
C#
27 lines
1.2 KiB
C#
|
|
using TeamUp.SharedKernel.Access;
|
||
|
|
using Xunit;
|
||
|
|
|
||
|
|
namespace TeamUp.IntegrationTests;
|
||
|
|
|
||
|
|
/// <summary>The gate decision matrix — pure policy, no database.</summary>
|
||
|
|
public sealed class GatePolicyTests
|
||
|
|
{
|
||
|
|
[Theory]
|
||
|
|
// Read never holds.
|
||
|
|
[InlineData(Autonomy.DraftOnly, ActionRisk.Read, false)]
|
||
|
|
[InlineData(Autonomy.Gated, ActionRisk.Read, false)]
|
||
|
|
[InlineData(Autonomy.Autonomous, ActionRisk.Read, false)]
|
||
|
|
// Draft/Publish hold unless the seat is Autonomous.
|
||
|
|
[InlineData(Autonomy.DraftOnly, ActionRisk.Draft, true)]
|
||
|
|
[InlineData(Autonomy.Gated, ActionRisk.Draft, true)]
|
||
|
|
[InlineData(Autonomy.Autonomous, ActionRisk.Draft, false)]
|
||
|
|
[InlineData(Autonomy.Gated, ActionRisk.Publish, true)]
|
||
|
|
[InlineData(Autonomy.Autonomous, ActionRisk.Publish, false)]
|
||
|
|
// Destructive ALWAYS holds — whatever the autonomy. The backstop.
|
||
|
|
[InlineData(Autonomy.DraftOnly, ActionRisk.Destructive, true)]
|
||
|
|
[InlineData(Autonomy.Gated, ActionRisk.Destructive, true)]
|
||
|
|
[InlineData(Autonomy.Autonomous, ActionRisk.Destructive, true)]
|
||
|
|
public void Gate_matrix(Autonomy autonomy, ActionRisk risk, bool shouldHold) =>
|
||
|
|
Assert.Equal(shouldHold, GatePolicy.ShouldHold(autonomy, risk));
|
||
|
|
}
|