47 lines
1.3 KiB
C#
47 lines
1.3 KiB
C#
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 Init()
|
|
{
|
|
Dict = EnumTranslations.UserRightType2Translations;
|
|
}
|
|
|
|
|
|
[TestMethod]
|
|
public void DictionaryCreation()
|
|
{
|
|
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 DictionaryComplete()
|
|
{
|
|
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)}");
|
|
}
|
|
}
|
|
}
|
|
}
|