Renaming -> Wrong T Search prevented

This commit is contained in:
2024-08-06 12:23:23 +02:00
parent ea0b9af8ee
commit f546b44bad
4 changed files with 62 additions and 47 deletions

View File

@@ -1,28 +0,0 @@
using BS.Shared;
using BS.Shared.Core;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
namespace TranslationUnitTest
{
[TestClass]
public class EnumTranslation
{
[TestInitialize]
public void Init()
{
}
[TestMethod]
public void UserRightType2TranslationsComplete()
{
var dict = EnumTranslations.UserRightType2Translations;
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)}");
}
}
}
}

View File

@@ -0,0 +1,41 @@
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)}");
}
}
}
}

View File

@@ -49,7 +49,7 @@
<Reference Include="System.Core" />
</ItemGroup>
<ItemGroup>
<Compile Include="EnumTranslation.cs" />
<Compile Include="EnumTranslationTest.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>