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:
@ -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)}");
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user