From 3e9a36ac4c51747318ea2dd8d52b01a87f1add18 Mon Sep 17 00:00:00 2001 From: DrSmugleaf Date: Sat, 19 Dec 2020 17:34:18 +0100 Subject: [PATCH] Add test for enum parity between JobPriority and DbJobPriority --- .../Tests/Job/JobPriorityTest.cs | 31 +++++++++++++++++++ Content.Server.Database/Model.cs | 2 +- Content.Shared/Preferences/JobPriority.cs | 2 +- 3 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 Content.IntegrationTests/Tests/Job/JobPriorityTest.cs diff --git a/Content.IntegrationTests/Tests/Job/JobPriorityTest.cs b/Content.IntegrationTests/Tests/Job/JobPriorityTest.cs new file mode 100644 index 0000000000..03e12ae964 --- /dev/null +++ b/Content.IntegrationTests/Tests/Job/JobPriorityTest.cs @@ -0,0 +1,31 @@ +using System; +using Content.Server.Database; +using Content.Shared.Preferences; +using NUnit.Framework; + +namespace Content.IntegrationTests.Tests.Job +{ + [TestFixture] + [TestOf(typeof(JobPriority))] + [TestOf(typeof(DbJobPriority))] + public class JobPriorityTest + { + [Test] + public void JobPriorityEnumParityTest() + { + var priorities = Enum.GetValues(); + var dbPriorities = Enum.GetValues(); + + Assert.That(priorities.Length, Is.EqualTo(dbPriorities.Length)); + + for (var i = 0; i < priorities.Length; i++) + { + var priority = priorities[i]; + var dbPriority = dbPriorities[i]; + + Assert.That((int) priority, Is.EqualTo((int) dbPriority)); + Assert.That(priority.ToString(), Is.EqualTo(dbPriority.ToString())); + } + } + } +} diff --git a/Content.Server.Database/Model.cs b/Content.Server.Database/Model.cs index 39f80bec76..2b2ac59a14 100644 --- a/Content.Server.Database/Model.cs +++ b/Content.Server.Database/Model.cs @@ -119,7 +119,7 @@ namespace Content.Server.Database public enum DbJobPriority { - // These enum values HAVE to match the ones in JobPriority in Shared. + // These enum values HAVE to match the ones in JobPriority in Content.Shared Never = 0, Low = 1, Medium = 2, diff --git a/Content.Shared/Preferences/JobPriority.cs b/Content.Shared/Preferences/JobPriority.cs index 73deac3523..bf0bbf6aad 100644 --- a/Content.Shared/Preferences/JobPriority.cs +++ b/Content.Shared/Preferences/JobPriority.cs @@ -2,7 +2,7 @@ namespace Content.Shared.Preferences { public enum JobPriority { - // These enum values HAVE to match the ones in DbJobPriority in Server.Database. + // These enum values HAVE to match the ones in DbJobPriority in Content.Server.Database Never = 0, Low = 1, Medium = 2,