public void GetValidationTransformerForModelShouldReturnNullWhenNoTransformerIsFoundForTheSpecifiedType() { IValidationTransformer validationTransformer = Substitute.For<IValidationTransformer>(); validationTransformer.UIModelType.Returns(typeof(string)); validationTransformer.ValidationModelType.Returns(typeof(int)); DefaultValidationTransformerManager validationTransformerManager = new DefaultValidationTransformerManager(); validationTransformerManager.RegisterValidationTransformer(validationTransformer); Assert.IsNull(validationTransformerManager.GetValidationTransformerForUIModel(typeof(int))); }
public void GetValidationTransformerForModelShouldReturnNullWhenNoTransformerIsFoundForTheSpecifiedType() { IValidationTransformer validationTransformer = Substitute.For <IValidationTransformer>(); validationTransformer.UIModelType.Returns(typeof(string)); validationTransformer.ValidationModelType.Returns(typeof(int)); DefaultValidationTransformerManager validationTransformerManager = new DefaultValidationTransformerManager(); validationTransformerManager.RegisterValidationTransformer(validationTransformer); Assert.IsNull(validationTransformerManager.GetValidationTransformerForUIModel(typeof(int))); }
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); }
public void GetValidationTransformerForModelShouldReturnNullWhenRegistyIsEmpty() { DefaultValidationTransformerManager validationTransformerManager = new DefaultValidationTransformerManager(); Assert.IsNull(validationTransformerManager.GetValidationTransformerForUIModel(typeof(string))); }