Skip to content

Commit

Permalink
StubManagerExtensions hotfix
Browse files Browse the repository at this point in the history
  • Loading branch information
MCKanpolat committed Feb 28, 2018
1 parent f591447 commit 8a6f768
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/StubMiddleware.Core/Extensions/StubManagerExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Linq;
using System.Reflection;

namespace StubGenerator.Core
Expand Down Expand Up @@ -42,7 +43,7 @@ public static object InvokeCreateNew(this IStubManager stubManager, string typeN
var type = LoadType(typeName);


MethodInfo method = typeof(IStubManager).GetMethod("CreateNew");
MethodInfo method = typeof(IStubManager).GetMethods().FirstOrDefault(w => w.Name == "CreateNew" && w.GetParameters().Count() == 2);
MethodInfo genericMethod = method.MakeGenericMethod(type);
return genericMethod.Invoke(stubManager, new object[] { subItemSize, null });
}
Expand All @@ -65,7 +66,7 @@ public static object InvokeCreateListOfSize(this IStubManager stubManager, strin
}

var type = LoadType(typeName);
MethodInfo method = typeof(IStubManager).GetMethod("CreateListOfSize");
MethodInfo method = typeof(IStubManager).GetMethods().FirstOrDefault(w => w.Name == "CreateListOfSize" && w.GetParameters().Count() == 3);
MethodInfo genericMethod = method.MakeGenericMethod(type);
return genericMethod.Invoke(stubManager, parameters: new object[] { size, subItemSize, null });
}
Expand Down

0 comments on commit 8a6f768

Please sign in to comment.