Skip to content

Commit

Permalink
Fix failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
volkanceylan committed Jan 3, 2025
1 parent 1f7fcfa commit a0ad83c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ private Type GetHandlerType((Type rowType, Type handlerInterface) args)

if (!defaults.Any())
{
defaults = handlers.Where(x => x.GetAttribute<DefaultHandlerAttribute>()?.Value != false);
if (defaults.Count() == 1)
return defaults.First();
var withoutDefaultsFalse = handlers.Where(x => x.GetAttribute<DefaultHandlerAttribute>()?.Value != false);
if (withoutDefaultsFalse.Count() == 1)
return withoutDefaultsFalse.First();
}

throw new InvalidProgramException($"There are multiple {args.handlerInterface.FullName} types " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,11 @@ public static IServiceCollection AddCustomRequestHandlers(this IServiceCollectio
if (defaults.Length != 1)
{
if (defaults.Length == 0)
defaults = pair.Value.Where(x => x.GetAttribute<DefaultHandlerAttribute>()?.Value != false).ToArray();
{
var withoutDefaultFalse = pair.Value.Where(x => x.GetAttribute<DefaultHandlerAttribute>()?.Value != false).ToArray();
if (withoutDefaultFalse.Length == 1)
defaults = withoutDefaultFalse;
}

if (defaults.Length != 1)
{
Expand Down

0 comments on commit a0ad83c

Please sign in to comment.