public void AsModelBinderForTypesRegistersTypeModelBinder()
        {
            var builder = new ContainerBuilder();
            builder.RegisterType<Dependency>();
            builder.RegisterType<TestModelBinder>().AsModelBinderForTypes(typeof(TestModel1), typeof(TestModel2));
            var container = builder.Build();
            var resolver = new AutofacWebApiDependencyResolver(container);
            var configuration = new HttpConfiguration {DependencyResolver = resolver};
            var provider = new AutofacWebApiModelBinderProvider();

            Assert.That(provider.GetBinder(configuration, typeof(TestModel1)), Is.InstanceOf<TestModelBinder>());
            Assert.That(provider.GetBinder(configuration, typeof(TestModel2)), Is.InstanceOf<TestModelBinder>());
        }
 public void AsModelBinderForTypesRegistersInstanceModelBinder()
 {
     var builder = new ContainerBuilder();
     var binder = new TestModelBinder(new Dependency());
     builder.RegisterInstance(binder).AsModelBinderForTypes(typeof(TestModel1));
     var container = builder.Build();
     var resolver = new AutofacWebApiDependencyResolver(container);
     var configuration = new HttpConfiguration { DependencyResolver = resolver };
     var provider = new AutofacWebApiModelBinderProvider();
     Assert.AreSame(binder, provider.GetBinder(configuration, typeof(TestModel1)));
 }