Add test for enum parity between JobPriority and DbJobPriority
This commit is contained in:
31
Content.IntegrationTests/Tests/Job/JobPriorityTest.cs
Normal file
31
Content.IntegrationTests/Tests/Job/JobPriorityTest.cs
Normal file
@@ -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<JobPriority>();
|
||||||
|
var dbPriorities = Enum.GetValues<DbJobPriority>();
|
||||||
|
|
||||||
|
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()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -119,7 +119,7 @@ namespace Content.Server.Database
|
|||||||
|
|
||||||
public enum DbJobPriority
|
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,
|
Never = 0,
|
||||||
Low = 1,
|
Low = 1,
|
||||||
Medium = 2,
|
Medium = 2,
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ namespace Content.Shared.Preferences
|
|||||||
{
|
{
|
||||||
public enum JobPriority
|
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,
|
Never = 0,
|
||||||
Low = 1,
|
Low = 1,
|
||||||
Medium = 2,
|
Medium = 2,
|
||||||
|
|||||||
Reference in New Issue
Block a user