public void ValueFor_NullReferenceInExpressionValue_ReturnsEmpty() { column.ExpressionValue = (model) => model.Name; String?actual = column.ValueFor(new GridRow <Object>(new GridModel(), 0)).ToString(); Assert.Empty(actual); }
public void ValueFor_NullEnum() { GridColumn <GridModel, TestEnum?> enumColumn = new GridColumn <GridModel, TestEnum?>(column.Grid, model => model.NEnum); IGridRow <GridModel> row = new GridRow <GridModel>(new GridModel(), 0); Assert.Empty(enumColumn.ValueFor(row).ToString()); }
public void ValueFor_UsesExpressionValueToGetValue() { column.ExpressionValue = (model) => "TestValue"; String actual = column.ValueFor(new GridRow(null)).ToString(); String expected = "TestValue"; Assert.Equal(expected, actual); }
public void ValueFor_EnumExpressionValue(TestEnum value, String expressionValue) { GridColumn <GridModel, TestEnum> enumColumn = new GridColumn <GridModel, TestEnum>(column.Grid, model => model.Enum); IGridRow <GridModel> row = new GridRow <GridModel>(new GridModel { Enum = value }, 0); String actual = enumColumn.ValueFor(row).ToString(); String expected = expressionValue; Assert.Equal(expected, actual); }
public void ValueFor_BadValue_EnumExpressionValue() { GridColumn <GridModel, TestEnum> enumColumn = new GridColumn <GridModel, TestEnum>(column.Grid, model => model.Enum); IGridRow <GridModel> row = new GridRow <GridModel>(new GridModel { Enum = (TestEnum)2 }, 0); String?actual = enumColumn.ValueFor(row).ToString(); String?expected = "2"; Assert.Equal(expected, actual); }
public void ValueFor_ExpressionValue_Html(String value, String format, Boolean isEncoded, String expressionValue) { IGridRow <GridModel> row = new GridRow <GridModel>(new GridModel { Content = value == null ? null : new HtmlString(value) }); column = new GridColumn <GridModel, Object>(grid, model => model.Content); column.IsEncoded = isEncoded; column.Format = format; String actual = column.ValueFor(row).ToString(); String expected = expressionValue; Assert.Equal(expected, actual); }