public void CreateGetFieldState() { var form = new FormWithDates() as IModelDefinitionForm; var fields = form.GetDetailsFields(); var items = new List <TestOrder>(); items.Add(new TestOrder { Id = 1, ClientId = 1, CreateDate = DateTime.Now }); var cont = new RepeaterDataComponentController(new Mock <IDataValidationProvider>().Object); cont.SetParameters(form, new FormViewOptions { }, form.GetDetailsType(), fields, items); var state = cont.CreateFieldState(fields.First(), 0); state.IsEditing = true; var readState = cont.CreateFieldState(fields.First(), 0); Assert.Equal(state, readState); Assert.True(readState.IsEditing); }
public void SetItemValueTest() { var form = new FormWithDates() as IModelDefinitionForm; var fields = form.GetDetailsFields(); var items = new List <TestOrder>(); items.Add(new TestOrder { Id = 1, ClientId = 1, CreateDate = DateTime.Now }); var cont = new RepeaterDataComponentController(new Mock <IDataValidationProvider>().Object); cont.SetParameters(form, new FormViewOptions { }, form.GetDetailsType(), fields, items); var field = fields.First(f => f.BindingProperty == "Id"); var state = cont.CreateFieldState(field, 0); state.Value = 17; cont.SetItemValue(field, state); var value = cont.GetItemValue(field, 0); Assert.Equal(17, value); }