public void CastStringFailed(string value) { Action action = () => { GridColumnAutoWidth gridColumnAutoWidth = value; }; action.Should().ThrowExactly <InvalidCastException>(); }
private static GridColumnWidth ToGridColumnWidth(string value) { if (GridColumnDefaultWidth.CanConvert(value)) { return((GridColumnDefaultWidth)value); } if (GridColumnAutoWidth.CanConvert(value)) { return((GridColumnAutoWidth)value); } if (GridColumnFixedWidth.CanConvert(value)) { return((GridColumnFixedWidth)value); } throw new InvalidCastException( $"The string can be only cast to {nameof(GridColumnWidth)} when value equals to '{GridColumnAutoWidth.CSS_CLASS_SUFFIX}' or null or empty or is a number (value={value})"); }