public override Task OverrideInterfaceAsync(GenericUserInterfaceBag bag, GenericUserInterfaceModelBuilder <SomeType> overrider) { overrider.GetBlockBuilder(x => x.Name) .SetAutoCompleteFor <SomeDataProvider>(); return(Task.CompletedTask); }
public override Task OverrideInterfaceAsync(GenericUserInterfaceBag bag, GenericUserInterfaceModelBuilder <SomeModel> overrider) { overrider.GetBlockBuilder(x => x.Prop1) .SetDropDownList <SomeSelectListDataProvider>(); return(Task.CompletedTask); }
public override Task OverrideInterfaceAsync(GenericUserInterfaceBag bag, GenericUserInterfaceModelBuilder <SomeTypeToOverride> builder) { builder.GetBlockBuilder(x => x.SomeProperty).SetLabel(LabelText).SetDropDownList(new List <SelectListItemData <string> > { new SelectListItemData <string> { Text = "Text", Selected = true, Value = "SomeValue" } }); return(Task.CompletedTask); }
public override Task OverrideInterfaceAsync(GenericUserInterfaceBag bag, GenericUserInterfaceModelBuilder <SomeInnerType> overrider) { overrider.GetBlockBuilder(x => x.Prop1) .SetDropDownList(new List <SelectListItemData <string> > { new SelectListItemData <string> { Selected = true, Text = "Text", Value = "Value" } }); return(Task.CompletedTask); }
public void ToEnumProperty_ShouldThrowException() { var builder = new GenericUserInterfaceModelBuilder <SomeClass>(TestsHelper.CreateDefaultBag()); var ex = Assert.Throws <InvalidOperationException>(() => builder.GetBlockBuilder(x => x.EnumProp).SetDropDownList(new List <SelectListItemData <SomeEnumType> >() { new SelectListItemData <SomeEnumType> { Selected = true, Value = SomeEnumType.Type1, } })); var expectedMessage = string.Format(ExceptionTexts.CantImplementSetDropListNameToEnumPropertyFormat, nameof(SomeClass.EnumProp)); Assert.AreEqual(expectedMessage, ex.Message); }
public void Test() { var builder = new GenericUserInterfaceModelBuilder <SomeClass>(TestsHelper.CreateDefaultBag()); var list = new List <SelectListItemData <bool?> > { new SelectListItemData <bool?> { Selected = true, Text = "Text", } }; builder.GetBlockBuilder(x => x.Sex).SetDropDownList(list); var lastProp = builder.Result.Interface.Blocks.Last(); Assert.IsTrue(lastProp.InterfaceType == UserInterfaceType.DropDownList); TestsHelper.AssertAreEqualViaJson(GenericUserInterfaceModelBuilderMappings.ToSelectListItems(list), lastProp.DropDownData.SelectList); }
public override Task OverrideInterfaceAsync(GenericUserInterfaceBag bag, GenericUserInterfaceModelBuilder <SomeType> overrider) { overrider.GetBlockBuilder(x => x.Prop2).SetTextArea(); return(Task.CompletedTask); }
public override Task OverrideInterfaceAsync(GenericUserInterfaceBag bag, GenericUserInterfaceModelBuilder <TestClass> overrider) { overrider.GetBlockBuilderForCollection(x => x.Descriptions) .SetMultipleDropDownList(new List <SelectListItemData <string> > { new SelectListItemData <string> { Selected = true, Text = "Описание 1", Value = "Value 1" }, new SelectListItemData <string> { Selected = false, Text = "Описание 2", Value = "Value 2" }, new SelectListItemData <string> { Selected = true, Text = "Описание 3", Value = "Value 3" }, new SelectListItemData <string> { Selected = false, Text = "Описание 4", Value = "Value 4" }, new SelectListItemData <string> { Selected = false, Text = "Описание 5", Value = "Value 5" } }); overrider.GetBlockBuilder(x => x.Name).SetDropDownList(new List <SelectListItemData <string> > { new SelectListItemData <string> { Value = "someValue1", Selected = true, Text = "someText1", }, new SelectListItemData <string> { Value = "someValue2", Selected = false, Text = "someText2" } }); overrider.GetBlockBuilder(x => x.SomeTextArea).SetTextArea(); overrider .GetBlockBuilderForCollection(x => x.AutoCompleteProp1) .SetAutoCompleteFor <TestDataProvider>(); overrider.GetBlockBuilder(x => x.AutoCompleteProp2) .SetAutoCompleteFor <TestDataProvider>(); return(Task.CompletedTask); }