public ValuesController() { for (int i = 1; i <= 100; i++) { Data.Add(new SelectModel { Id = i, Value = $"value_{i}", Selected = i % 3 == 0 }); } for (int i = 1; i <= 4; i++) { var dataGroup = new SelectGroupModel { GroupId = i, GroupValue = $"group_value_{i}", Options = new List <SelectModel>() }; for (int j = 1; j <= 5; j++) { dataGroup.Options.Add(new SelectModel { Id = j, Value = $"value_{j}", Selected = j % 3 == 0 }); } DataGroup.Add(dataGroup); } for (int i = 1; i <= 5; i++) { var radioButton = new RadioButtonModel { Id = i, Value = $"value_{i}", Icon = i == 4 ? "fa fa-star" : string.Empty, IsDefault = i == 2, IsDisabled = i == 3 }; DataRadioButton.Add(radioButton); } }
private string DisplayRadioButtonIndicator(RowIndicatorViewModel indicator) { var radioModel = new RadioButtonModel( indicator.IndicatorId.ToString(), "indicator-radio-button", dataAttributes: new Dictionary <string, string>() { { "tableSelectable", "true" }, }, htmlClass: "radiobutton-selectable"); return(this.RenderRazorViewToString("Controls/Inputs/RadioButton", radioModel)); }
public void WhenRadioButtonInvoked_TheViewModelIsUpdated(string key, string value) { var values = new Dictionary <string, string>() { { key, value } }; var component = new RadioButton(); component.ViewComponentContext = ViewComponentTestHelper.GetViewComponentContext(); ViewViewComponentResult result = component.Invoke(values) as ViewViewComponentResult; RadioButtonModel resultModel = (RadioButtonModel)result.ViewData.Model; //Assert value.Should().Be(ViewComponentTestHelper.GetPropertyValue(resultModel, key)); }