protected override void Configure( IEnumTypeDescriptor <Foo> descriptor) { descriptor.BindItems(BindingBehavior.Explicit); descriptor.Item(Foo.Bar); descriptor.Item(Foo.Baz); }
public void ExplicitValueBinding() { // arrange var descriptor = EnumTypeDescriptor.New(Context, typeof(FooEnum)); // act IEnumTypeDescriptor desc = descriptor; desc.Item(FooEnum.Bar1).Name("FOOBAR"); desc.BindItems(BindingBehavior.Explicit); // assert EnumTypeDefinition description = descriptor.CreateDefinition(); Assert.Collection(description.Values, t => { Assert.Equal("FOOBAR", t.Name); Assert.Equal(FooEnum.Bar1, t.Value); }); }