Binder für benutzerdefinierte Modelltests in ASP.NET MVC 2

Ich habe einen benutzerdefinierten Modellordner in Project geschrieben, der ASP.NET MVC 2 verwendet. Dieser Modellordner bindet nur zwei Felder des Modells:

public class TaskFormBinder : DefaultModelBinder
{
    protected override void BindProperty(ControllerContext controllerContext,
        ModelBindingContext bindingContext,
        PropertyDescriptor propertyDescriptor)
    {           
        if (propertyDescriptor.Name == "Type")
        {
            var value = bindingContext.ValueProvider.GetValue("Type");
            var typeId = value.ConvertTo(typeof(int));
            TaskType foundedType;
            using (var nhSession = Domain.GetSession())
            {
                foundedType = nhSession.Get<TaskType>(typeId);
            }
            if (foundedType != null)
            {
                SetProperty(controllerContext, bindingContext, propertyDescriptor, foundedType);
            }
            else
            {
                AddModelBindError(bindingContext, propertyDescriptor);
            }
            return;
        }
        if (propertyDescriptor.Name == "Priority")
        { /* Other field binding ... */
            return;
        }
        base.BindProperty(controllerContext, bindingContext, propertyDescriptor);
    }
}

Wie kann ich diesen Modellbinder mit Standard-VS-Einheitentests testen? Verbrachte einige Stunden mit googeln, finden Sie einige Beispiele (http://www.hanselman.com/blog/SplittingDateTimeUnitTestingASPNETMVCCustomModelBinders.aspx), aber dieses Beispiel gilt für MVC1 und funktioniert bei Verwendung von MVC2 nicht.

Ich schätze Ihre Hilfe.

Antworten auf die Frage(2)

Ihre Antwort auf die Frage