0
mirror of https://github.com/sampletext32/ParkanPlayground.git synced 2025-06-19 16:08:02 +03:00

remove duplicate registration

This commit is contained in:
bird_egop
2025-04-18 01:02:14 +03:00
parent 66f9e838ad
commit 84d5652a62
2 changed files with 24 additions and 26 deletions

View File

@ -40,5 +40,21 @@ public class InstructionHandlerFactoryTests
{
Assert.Contains(handlers, x => x.GetType() == handlerType);
}
var uniqueRegisteredHandlers = new HashSet<string>();
var duplicates = new List<string>();
foreach (var handler in handlers)
{
if (!uniqueRegisteredHandlers.Add(handler.GetType().Name))
{
duplicates.Add(handler.GetType().Name);
}
}
if (duplicates.Count != 0)
{
Assert.Fail($"The following handlers are registered more than 1 time:\n" +
$"{string.Join("\n", duplicates)}");
}
}
}