public EnumPropertyMapping(EnumColumn <TEnum> column, IMemberAccessor member, int physicalIndex, int logicalIndex) { this.column = column; Member = member; PhysicalIndex = physicalIndex; LogicalIndex = logicalIndex; }
public EnumPropertyMapping(EnumColumn <TEnum> column, IMemberAccessor member, int fileIndex, int workIndex) { this.column = column; this.member = member; this.FileIndex = fileIndex; this.WorkIndex = workIndex; }
public void TestFormat_IntegerStringReturned() { EnumColumn <MyEnum> column = new EnumColumn <MyEnum>("count"); string actual = column.Format(null, MyEnum.First); string expected = "1"; Assert.AreEqual(expected, actual); }
public void TestParse_ValueBlank_NullReturned() { EnumColumn <MyEnum> column = new EnumColumn <MyEnum>("count"); MyEnum?actual = (MyEnum?)column.Parse(null, " "); MyEnum?expected = null; Assert.AreEqual(expected, actual); }
public void TestParse_StringValue_EnumReturned() { EnumColumn <MyEnum> column = new EnumColumn <MyEnum>("count"); MyEnum actual = (MyEnum)column.Parse(null, "First"); MyEnum expected = MyEnum.First; Assert.AreEqual(expected, actual); }
public void TestParse_Int32Value_EnumReturned() { EnumColumn <MyEnum> column = new EnumColumn <MyEnum>("count"); MyEnum actual = (MyEnum)column.Parse("1"); MyEnum expected = MyEnum.First; Assert.Equal(expected, actual); }
/// <summary> /// Binds an enum column to <see cref="ComboBox"/>. /// </summary> /// <typeparam name="T">The type of the enum.</typeparam> /// <param name="source">The source column.</param> /// <returns>The row binding object.</returns> public static RowBinding <ComboBox> BindToComboBox <T>(this EnumColumn <T> source) where T : struct, IConvertible { return(source.BindToComboBox(source.EnumItems.Select(x => new { Value = x.Value, Display = x.Description }))); }
public void TestFormat_OverrideFormatter_UsesCustomFormatter() { EnumColumn <MyEnum> column = new EnumColumn <MyEnum>("count"); column.Formatter = e => e.ToString(); string actual = column.Format(MyEnum.First); string expected = "First"; Assert.AreEqual(expected, actual); }
public static Column AddEnumColumn <TEnum>(this IList <Column> columns, string name, string path, string label) where TEnum : struct { var identifier = name.ToLowerInvariant(); var column = new EnumColumn { Name = name, InitialVisible = true, Header = label, Path = path, CssClass = $"column-{identifier}", ColumnFilter = new EnumFilter <TEnum> { FilterExpression = $"{identifier}=?" } }; columns.Add(column); return(column); }
public EnumPropertyMapping(EnumColumn <TEnum> column, PropertyInfo property) { this.column = column; this.property = property; }
public IInsertSet Set <ENUM>(EnumColumn <ENUM> column, ENUM value) { this.mSetValueList.Add(new SetValue(column, value)); return(this); }
public void TestCtor_SetsName_Trimmed() { EnumColumn <MyEnum> column = new EnumColumn <MyEnum>(" Name "); Assert.AreEqual("Name", column.ColumnName); }