Files
tgstation-server/tests/Tgstation.Server.Api.Tests/Models/TestJobCode.cs
Jordan Dominion ebd09d7e86 Add JobCodes to strongly type jobs
- Default `0` for legacy jobs.
- Standardize job creation prior to registration.
- Add `RightsHelper.TypeToRight()`.
2023-11-04 21:12:25 -04:00

28 lines
667 B
C#

using System;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Tgstation.Server.Api.Models.Tests
{
[TestClass]
public sealed class TestJobCode
{
[TestMethod]
public void TestAllCodesHaveDescription()
{
var jobCodeType = typeof(JobCode);
foreach (var code in Enum.GetValues(typeof(JobCode)).Cast<JobCode>())
Assert.IsFalse(
String.IsNullOrWhiteSpace(
jobCodeType
.GetField(code.ToString())
.GetCustomAttributes(false)
.OfType<System.ComponentModel.DescriptionAttribute>()
.FirstOrDefault()
?.Description),
$"JobCode {code} is missing a description!");
}
}
}