From 8a6f768bb986c9f68993ee8ec583e03c26d9d4bd Mon Sep 17 00:00:00 2001 From: MCKanpolat Date: Wed, 28 Feb 2018 16:26:06 +0300 Subject: [PATCH] StubManagerExtensions hotfix --- src/StubMiddleware.Core/Extensions/StubManagerExtensions.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/StubMiddleware.Core/Extensions/StubManagerExtensions.cs b/src/StubMiddleware.Core/Extensions/StubManagerExtensions.cs index f570adb..1d1a6f4 100644 --- a/src/StubMiddleware.Core/Extensions/StubManagerExtensions.cs +++ b/src/StubMiddleware.Core/Extensions/StubManagerExtensions.cs @@ -1,4 +1,5 @@ using System; +using System.Linq; using System.Reflection; namespace StubGenerator.Core @@ -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 }); } @@ -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 }); }