feat(commons): add Audit{Channel,Kind,Status,ForwardState} enums for #23
This commit is contained in:
72
tests/ScadaLink.Commons.Tests/Types/Enums/AuditEnumTests.cs
Normal file
72
tests/ScadaLink.Commons.Tests/Types/Enums/AuditEnumTests.cs
Normal file
@@ -0,0 +1,72 @@
|
||||
using ScadaLink.Commons.Types.Enums;
|
||||
|
||||
namespace ScadaLink.Commons.Tests.Types.Enums;
|
||||
|
||||
/// <summary>
|
||||
/// Asserts the exact member sets of the Audit Log (#23) enums.
|
||||
/// Lock-in tests; any addition/removal/rename is a deliberate design change
|
||||
/// that must come with a corresponding update to alog.md §4.
|
||||
/// </summary>
|
||||
public class AuditEnumTests
|
||||
{
|
||||
[Fact]
|
||||
public void AuditChannel_HasExactlyExpectedMembers()
|
||||
{
|
||||
var expected = new[] { "ApiOutbound", "DbOutbound", "Notification", "ApiInbound" };
|
||||
var actual = Enum.GetValues(typeof(AuditChannel))
|
||||
.Cast<AuditChannel>()
|
||||
.Select(x => x.ToString())
|
||||
.ToArray();
|
||||
|
||||
Assert.Equal(expected.Length, actual.Length);
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AuditKind_HasExactlyTenExpectedMembers()
|
||||
{
|
||||
var expected = new[]
|
||||
{
|
||||
"ApiCall", "ApiCallCached", "DbWrite", "DbWriteCached",
|
||||
"NotifySend", "NotifyDeliver", "InboundRequest", "InboundAuthFailure",
|
||||
"CachedSubmit", "CachedResolve",
|
||||
};
|
||||
var actual = Enum.GetValues(typeof(AuditKind))
|
||||
.Cast<AuditKind>()
|
||||
.Select(x => x.ToString())
|
||||
.ToArray();
|
||||
|
||||
Assert.Equal(10, actual.Length);
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AuditStatus_HasExactlyEightExpectedMembers()
|
||||
{
|
||||
var expected = new[]
|
||||
{
|
||||
"Submitted", "Forwarded", "Attempted", "Delivered",
|
||||
"Failed", "Parked", "Discarded", "Skipped",
|
||||
};
|
||||
var actual = Enum.GetValues(typeof(AuditStatus))
|
||||
.Cast<AuditStatus>()
|
||||
.Select(x => x.ToString())
|
||||
.ToArray();
|
||||
|
||||
Assert.Equal(8, actual.Length);
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AuditForwardState_HasExactlyExpectedMembers()
|
||||
{
|
||||
var expected = new[] { "Pending", "Forwarded", "Reconciled" };
|
||||
var actual = Enum.GetValues(typeof(AuditForwardState))
|
||||
.Cast<AuditForwardState>()
|
||||
.Select(x => x.ToString())
|
||||
.ToArray();
|
||||
|
||||
Assert.Equal(expected.Length, actual.Length);
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user