Add unit test to check for duplicate log types

This commit is contained in:
DrSmugleaf
2021-11-22 22:04:45 +01:00
parent af6353da46
commit ce94c28e8a

View 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));
}
}