Add unit test to check for duplicate log types
This commit is contained in:
23
Content.Tests/Shared/Administration/Logs/LogTypeTests.cs
Normal file
23
Content.Tests/Shared/Administration/Logs/LogTypeTests.cs
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using Content.Shared.Administration.Logs;
|
||||||
|
using NUnit.Framework;
|
||||||
|
|
||||||
|
namespace Content.Tests.Shared.Administration.Logs;
|
||||||
|
|
||||||
|
[TestFixture]
|
||||||
|
public class LogTypeTests
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public void Unique()
|
||||||
|
{
|
||||||
|
var types = Enum.GetValues<LogType>();
|
||||||
|
var duplicates = types
|
||||||
|
.GroupBy(x => x)
|
||||||
|
.Where(g => g.Count() > 1)
|
||||||
|
.Select(g => g.Key)
|
||||||
|
.ToArray();
|
||||||
|
|
||||||
|
Assert.That(duplicates.Length, Is.Zero, $"{nameof(LogType)} has duplicate values for: " + string.Join(", ", duplicates));
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user