代码:
IFixture fixture = new Fixture().Customize(new AutoMoqCustomization());
fixture.Customize<ViewDataDictionary>(c => c.Without(x => x.ModelMetadata));
var target = fixture.CreateAnonymous<MyController>();
Run Code Online (Sandbox Code Playgroud)
例外:
System.Reflection.TargetInvocationException:System.Reflection.TargetInvocationException:调用目标已抛出异常.---> System.NotImplementedException:未实现方法或操作.
MyController() 需要3个参数.
我试着在答案中描述的修复在这里,但它是行不通的.