From ce94c28e8accca783ae5f28b148a21207dfb6ef3 Mon Sep 17 00:00:00 2001 From: DrSmugleaf Date: Mon, 22 Nov 2021 22:04:45 +0100 Subject: [PATCH] Add unit test to check for duplicate log types --- .../Administration/Logs/LogTypeTests.cs | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Content.Tests/Shared/Administration/Logs/LogTypeTests.cs diff --git a/Content.Tests/Shared/Administration/Logs/LogTypeTests.cs b/Content.Tests/Shared/Administration/Logs/LogTypeTests.cs new file mode 100644 index 0000000000..5e2a5f5da7 --- /dev/null +++ b/Content.Tests/Shared/Administration/Logs/LogTypeTests.cs @@ -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(); + 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)); + } +}