私のアプリケーションには、global.asax の DefaultBinder に設定したカスタム モデル バインダーがあります。
ModelBinders.Binders.DefaultBinder = new XLDataAnnotationsModelBinder();
コントローラーの単体テストを作成するときは、コントローラーがカスタム モデル バインダーを使用していることを確認する必要がありますが、その方法がわかりません。
私のテストは次のようになります。
[Test]
public void Details_Post_Action_Fails_To_Change_Email_Address_With_Duplicate()
{
// Setup
var controller = new AccountController();
controller.SetFakeControllerContext();
var param = Customer.Load(30005);
param.EmailAddress = "foo@bar.com";
// Test
var result = controller.Details(param);
// Assert
Assert.IsTrue(result is ViewResult); // will be ViewResult if failed....
Assert.IsFalse(((ViewResult)result).ViewData.ModelState.IsValid);
}
この単体テストでは、コントローラーは DefaultModelBinder を使用することになります。コントローラーがカスタム モデル バインダーを使用していることを確認するために、このテストに何を追加できますか?