J'utilise une extension du contrôleur, et j'ai essayé de se moquer de l'aide FakeItEasy (v 1.7.4) comme ceci:est-il possible de simuler/simuler une méthode d'extension?
A.CallTo(() => controller.RenderView(A<string>.Ignored,A<object>.Ignored,null)).Returns("");
mais je reçois cette erreur:
System.NullReferenceException : Object reference not set to an instance of an object.
at System.Object.GetType()
at FakeItEasy.Creation.ProxyGeneratorSelector.MethodCanBeInterceptedOnInstance(MethodInfo method, Object callTarget, ref String failReason)
at FakeItEasy.Configuration.DefaultInterceptionAsserter.AssertThatMethodCanBeInterceptedOnInstance(MethodInfo method, Object callTarget)
at FakeItEasy.Configuration.FakeConfigurationManager.CallTo(Expression`1 callSpecification)
Alternativement, si vous voulez une option gratuite, Moles permet aussi moqueur des méthodes statiques: http: // recherche .microsoft.com/fr-fr/projects/pex/ –
Cela vient peut-être à FakeItEasy. Combien de temps, je ne suis pas sûr - https://github.com/FakeItEasy/FakeItEasy/issues/90 –