public void ValueGetter_ReturnsCorrectPropertyOrField_ActualValue(string field, string expected) { var test = GetTest(); var valueGetter = FunctionCompiler.CreateValueGetter <Test>(field); Assert.Equal(expected, valueGetter(test)?.ToString()); }
public BaseDataGridColumn() { // TODO: move this to cached FunctionCompiler so it doesn't get compiled every time valueTypeGetter = new Lazy <Func <Type> >(() => FunctionCompiler.CreateValueTypeGetter <TItem>(Field)); defaultValueByType = new Lazy <Func <object> >(() => FunctionCompiler.CreateDefaultValueByType <TItem>(Field)); valueGetter = new Lazy <Func <TItem, object> >(() => FunctionCompiler.CreateValueGetter <TItem>(Field)); valueSetter = new Lazy <Action <TItem, object> >(() => FunctionCompiler.CreateValueSetter <TItem>(Field)); }