public void SetUp()
        {
            parent = new Parent
            {
                Id = 10,
                Name = "Parent from repository",
                Child = new Child
                {
                    Id = 3,
                    Name = "Child of Parent from repository"
                }
            };

            parentRepository = new FakeRepository(id => parent);
            childRepository = new FakeRepository(id => parent.Child);

            repositoryResolver = MockRepository.GenerateStub<IRepositoryResolver>();
            repositoryResolver.Stub(r => r.GetRepository(typeof (Parent))).Return(parentRepository);
            repositoryResolver.Stub(r => r.GetRepository(typeof (Child))).Return(childRepository);

            entityModelBinder = new EntityModelBinder(repositoryResolver);
            controllerContext = new ControllerContext
            {
                HttpContext = MockRepository.GenerateStub<HttpContextBase>()
            };
            request = MockRepository.GenerateStub<HttpRequestBase>();
            controllerContext.HttpContext.Stub(x => x.Request).Return(request);

            entityModelBinder.SetModelBinderDictionary(new ModelBinderDictionary { DefaultBinder = entityModelBinder });
        }
        public void SetUp()
        {
            mySubclass = new MySubclass {Id = myBaseId, Name = "the name"};

            var repository = MockRepository.GenerateStub<IRepository>();
            var repositoryResolver = MockRepository.GenerateStub<IRepositoryResolver>();

            repositoryResolver.Stub(r => r.GetRepository(typeof (MyBase))).Return(repository);
            repositoryResolver.Stub(r => r.GetRepository(typeof (MySubclass))).Return(repository);
            repository.Stub(r => r.GetById(myBaseId)).Return(mySubclass);
            
            entityModelBinder = new EntityModelBinder(repositoryResolver);

            controllerContext = new ControllerContext
            {
                HttpContext = MockRepository.GenerateStub<HttpContextBase>()
            };
            request = MockRepository.GenerateStub<HttpRequestBase>();
            controllerContext.HttpContext.Stub(x => x.Request).Return(request);
        }