/// <summary>
 /// Binds the model
 /// </summary>
 /// <param name="controllerContext"></param>
 /// <param name="bindingContext"></param>
 /// <returns></returns>
 public override object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
 {
     return(HiveIdModelBinder.PerformBindModel(controllerContext, bindingContext));
 }
        private HiveId ExecuteBinding(IValueProvider form, RouteData routeData, out ModelBindingContext bindingContext, out ControllerContext controllerContext)
        {

            var modelBinder = new HiveIdModelBinder();
            var httpContextFactory = new FakeHttpContextFactory("~/Umbraco/Editors/ContentEditor/Edit/1", routeData);



            var fakeFrameworkContext = new FakeFrameworkContext();
            var hive = FakeHiveCmsManager.New(fakeFrameworkContext);
            var appContext = new FakeUmbracoApplicationContext(hive);
            var resolverContext = new MockedMapResolverContext(fakeFrameworkContext, hive, new MockedPropertyEditorFactory(appContext), new MockedParameterEditorFactory());
            var webmModelMapper = new CmsModelMapper(resolverContext);

            fakeFrameworkContext.SetTypeMappers(new FakeTypeMapperCollection(new AbstractMappingEngine[] { webmModelMapper, new FrameworkModelMapper(fakeFrameworkContext) }));
            var umbracoApplicationContext = new FakeUmbracoApplicationContext(hive);

            controllerContext = new ControllerContext(
                httpContextFactory.RequestContext,
                new ContentEditorController(new FakeBackOfficeRequestContext(umbracoApplicationContext)));

            //put both the form and route values in the value provider
            var routeDataValueProvider = new RouteDataValueProvider(controllerContext);
            var values = new ValueProviderCollection(new List<IValueProvider>()
                                                         {
                                                             form, 
                                                             routeDataValueProvider
                                                         });

            bindingContext = GetBindingContext(new HiveId(1), values);

            //do the binding!

            var model = modelBinder.BindModel(controllerContext, bindingContext);

            //assert!

            Assert.That(model, Is.InstanceOf<HiveId>(), "Model isn't a HiveId");
            var boundModel = (HiveId)model;
            return boundModel;
        }