Files
BeWoPlaner/TranslationUnitTest/EnumTranslationTest.cs

42 lines
1.3 KiB
C#
Raw Normal View History

2024-08-06 12:23:23 +02:00
using BS.Shared;
using BS.Shared.Core;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
namespace TranslationUnitTest
{
[TestClass]
public class EnumTranslationTest
{
public Dictionary<UserRightType, String> Dict { get; set; }
[TestInitialize]
public void UserRightTypeCreation()
{
Dict = EnumTranslations.UserRightType2Translations;
var values = new Dictionary<long, UserRightType>();
foreach (UserRightType item in Enum.GetValues(typeof(UserRightType)))
{
var value = (long)item;
if (values.ContainsKey(value))
Assert.Fail($"\"{item}\" und \"{values[value]}\" haben den gleichen Wert \"{value}\"");
values.Add(value, item);
}
}
[TestMethod]
public void UserRightType2TranslationsComplete()
{
foreach (UserRightType item in Enum.GetValues(typeof(UserRightType)))
{
if (item != UserRightType.None && !Dict.ContainsKey(item))
Assert.Fail($"UserRight \"{item}\" hat keine Übersetzung in {nameof(EnumTranslations.UserRightType2Translations)}");
}
}
}
}