Mercurial > altnet-hispano
view Agendas/trunk/src/Agendas.Web.Tests/Controllers/MvcControllerTestsBase.cs @ 302:11dddcc9a862 tip
Historico de Eventos, no muestra bien la Url del Patrocinador.
author | juanjose.montesdeocaarbos |
---|---|
date | Tue, 14 Aug 2012 21:54:30 -0300 |
parents | bf993f99cee3 |
children |
line wrap: on
line source
using System.Web; using System.Web.Mvc; using System.Web.Routing; using Moq; namespace Agendas.Web.Tests.Controllers { public class MvcControllerTestsBase { protected ControllerContext ControllerCtx = new ControllerContext(); protected static TModel BindModel<TModel>(Controller controller, IValueProvider valueProvider) where TModel : class { var binder = ModelBinders.Binders.GetBinder(typeof(TModel)); var bindingContext = new ModelBindingContext() { FallbackToEmptyPrefix = true, ModelMetadata = ModelMetadataProviders.Current.GetMetadataForType(null, typeof(TModel)), ModelName = "NotUsedButNotNull", ModelState = controller.ModelState, PropertyFilter = (name => true), ValueProvider = valueProvider }; return (TModel)binder.BindModel(controller.ControllerContext, bindingContext); } } }