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)));
        }
예제 #2
0
        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)));
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }
예제 #5
0
        public void GetValidationTransformerForModelShouldReturnNullWhenRegistyIsEmpty()
        {
            DefaultValidationTransformerManager validationTransformerManager = new DefaultValidationTransformerManager();

            Assert.IsNull(validationTransformerManager.GetValidationTransformerForUIModel(typeof(string)));
        }
        public void GetValidationTransformerForModelShouldReturnNullWhenRegistyIsEmpty()
        {
            DefaultValidationTransformerManager validationTransformerManager = new DefaultValidationTransformerManager();

            Assert.IsNull(validationTransformerManager.GetValidationTransformerForUIModel(typeof(string)));
        }