public void RegisterValidatorAndRetrieve()
        {
            DefaultEntityValidatorFactory validatorFactory  = new DefaultEntityValidatorFactory();
            CustomerValidator             customerValidator = new CustomerValidator();

            validatorFactory.RegisterValidator(customerValidator);
            IEntityValidator <Customer> entityValidator = validatorFactory.GetValidatorFor <Customer>();

            Assert.IsNotNull(entityValidator);
            Assert.AreSame(customerValidator, entityValidator);
        }
        public void GetValidatorForShouldReturnTheRegisteredEntityValidator()
        {
            IEntityValidator <string> entityValidator = Substitute.For <IEntityValidator <string> >();

            DefaultEntityValidatorFactory validatorFactory = new DefaultEntityValidatorFactory();

            validatorFactory.RegisterValidator(entityValidator);

            Assert.AreSame(entityValidator, validatorFactory.GetValidatorFor <string>());
            Assert.AreSame(entityValidator, validatorFactory.GetValidatorFor(typeof(string)));
        }
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            DefaultEntityValidatorFactory validatorFactory = new DefaultEntityValidatorFactory();
            validatorFactory.RegisterValidator(new CustomerInsertDtoValidator());

            DefaultValidationTransformerManager validationTransformerManager = new DefaultValidationTransformerManager();
            validationTransformerManager.RegisterValidationTransformer(new CustomerInsertModelToDtoValidationTransformer());

            ValidatorSettings.ValidationTransformerManager = validationTransformerManager;

            LaboModelValidatorProvider.Configure(validatorFactory);
        }
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            DefaultEntityValidatorFactory validatorFactory = new DefaultEntityValidatorFactory();

            validatorFactory.RegisterValidator(new CustomerInsertDtoValidator());

            DefaultValidationTransformerManager validationTransformerManager = new DefaultValidationTransformerManager();

            validationTransformerManager.RegisterValidationTransformer(new CustomerInsertModelToDtoValidationTransformer());

            ValidatorSettings.ValidationTransformerManager = validationTransformerManager;

            LaboModelValidatorProvider.Configure(validatorFactory);
        }