I have a ViewModel like this:
public class BraintreeCallbackApiModel
{
[ModelBinder(Name = "bt_signature")]
public string Signature { get; set; }
[ModelBinder(Name = "bt_payload")]
public string Payload { get; set; }
}
The values are POSTed to controller as x-www-form-urlencoded
parameters. I want to unit test the binding behavior - that bt_signature
field is properly mapped to Signature
.
I would like to avoid using TestServer
and HttpClient
as it's not needed overhead in this case.
I looked at ModelBinder tests on GitHub but couldn't get it to bind to my model class.