public void Construct() { var sut = new ModelBinding(); Assert.IsAssignableFrom <AspNetTab>(sut); Assert.IsAssignableFrom <ITabSetup>(sut); }
public void Construct() { var sut = new ModelBinding(); Assert.IsAssignableFrom<AspNetTab>(sut); Assert.IsAssignableFrom<ITabSetup>(sut); }
public void SubscribeToMessages(ModelBinding sut, ITabSetupContext context) { sut.Setup(context); context.MessageBroker.Verify(mb => mb.Subscribe(It.IsAny<Action<ValueProvider<IValueProvider>.GetValue.Message>>())); context.MessageBroker.Verify(mb => mb.Subscribe(It.IsAny<Action<ValueProvider<IUnvalidatedValueProvider>.GetValue.Message>>())); context.MessageBroker.Verify(mb => mb.Subscribe(It.IsAny<Action<ModelBinder.BindModel.Message>>())); context.MessageBroker.Verify(mb => mb.Subscribe(It.IsAny<Action<ModelBinder.BindProperty.Message>>())); }
public void SubscribeToMessages(ModelBinding sut, ITabSetupContext context) { sut.Setup(context); context.MessageBroker.Verify(mb => mb.Subscribe(It.IsAny <Action <ValueProvider <IValueProvider> .GetValue.Message> >())); context.MessageBroker.Verify(mb => mb.Subscribe(It.IsAny <Action <ValueProvider <IUnvalidatedValueProvider> .GetValue.Message> >())); context.MessageBroker.Verify(mb => mb.Subscribe(It.IsAny <Action <ModelBinder.BindModel.Message> >())); context.MessageBroker.Verify(mb => mb.Subscribe(It.IsAny <Action <ModelBinder.BindProperty.Message> >())); }
public void TestGetBinding() { var binding = new ModelBinding(_model, TestModel.StrProperty); _viewModel.SetBinding(TestViewModel.TextProperty, binding); Assert.That(_viewModel.GetBinding(TestViewModel.TextProperty), Is.SameAs(binding)); Assert.That(_viewModel.GetBinding(TestViewModel.IntegerProperty), Is.Null); }
private static ModelBinding CreateModelBinding() { var model = new ModelBinding { Int = 1, Prop = "The Prop", Object = new NestedModelBinding { Int = 2, Prop = "Nested Prop", Object = new ModelBinding { Int = 21, Prop = "Nested Nested Prop", }, AltNested = new AltNested { Field = "Object AltNested Field" } }, Dictionary = new Dictionary <string, ModelBinding> { { "map-key", new ModelBinding { Int = 3, Prop = "Dictionary Prop", Object = new NestedModelBinding { Int = 5, Prop = "Nested Dictionary Prop", AltNested = new AltNested { Field = "Dictionary AltNested Field" } } } }, }, List = new List <ModelBinding> { new ModelBinding { Int = 4, Prop = "List Prop", Object = new NestedModelBinding { Int = 5, Prop = "Nested List Prop" } } } }; return(model); }
protected void Application_Start() { // Проставим timestamp для ETagCultureBased // Если приложение перегружалось, необходимо очистить кеш клиента ETagConfig.Timestamp = DateTime.Now.Ticks.ToString(); BLToolkit.Common.Configuration.NullableValues.String = null; BLToolkit.Common.Configuration.TrimOnMapping = false; // Set our model metadata provider to support Description attribute ModelMetadataProviders.Current = new KescoDataAnnotationsModelMetadataProvider(); LogModule logModule = new LogModule(Configuration.AppSettings.AppName); logModule.Init(Configuration.AppSettings.SmtpServer, Configuration.AppSettings.Email_Support); Logger.Init(logModule); Logging.Logger.Init(logModule); // Инициализируем TAPI //Kesco.Zvonilka.Zvonilka.InitTapi(Configuration.AppSettings.AppName, false, false); AreaRegistration.RegisterAllAreas(); ModelBinding.RegisterBinders(); RegisterGlobalFilters(GlobalFilters.Filters); RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); //set the build version, so all composite resource requests include build //will invalite cache when no build is deployed Version v = Assembly.GetExecutingAssembly().GetName(false).Version; string version = Configuration.AppSettings.URI_styles_cache;// string.Format("{0}{1}{2}{3}", v.Major, v.Minor, v.Build, v.Revision); CompositeResourceSettings.Version = version; // Устанавливаем собственный провайдер метаданных ModelMetadataProviders.Current = new KescoDataAnnotationsModelMetadataProvider(); // Определяем собственный JsonValue Provider : Kesco.Web.Mvc.JsonValueProviderFactory ValueProviderFactories.Factories.Remove(ValueProviderFactories.Factories.OfType <System.Web.Mvc.JsonValueProviderFactory>().FirstOrDefault()); ValueProviderFactories.Factories.Add(new Kesco.Web.Mvc.JsonValueProviderFactory()); // Регистрируем адаптеры для клиентской валидации ModelValidatorRegistration.RegisterAdapters(); // Регистрируем собсвенный связыватель данных. ModelBinders.Binders.DefaultBinder = new DefaultModelBinderEx(); }
public void ReturnProperName(ModelBinding sut) { Assert.Equal("Model Binding", sut.Name); }
public void SetUp() { model = new(); backend = new(); sut = ModelBinding.New(model, backend); }