src/GenFx.Wpf.Tests/EnumViewModelConverterTest.cs
/// <summary>
/// Tests that the <see cref="EnumViewModelConverter.Convert"/> method works correctly.
/// </summary>
Tests that the  method works correctly.
Tests that the method works correctly .
[Fact]
        public void EnumViewModelConverter_Convert()
        {
            EnumViewModelConverter converter = new EnumViewModelConverter();
            List<Enum> enumValues = new List<Enum>();
            enumValues.AddRange(Enum.GetValues(typeof(FitnessType)).Cast<Enum>());
            enumValues.AddRange(Enum.GetValues(typeof(FitnessSortOption)).Cast<Enum>());
            object result;
            foreach (Enum val in enumValues)
            {
                result = converter.Convert(val, null, null, null);
                EnumViewModel viewModel = (EnumViewModel)result;
                Assert.Equal(val, viewModel.Value);
                Assert.True(!(String.IsNullOrEmpty(viewModel.DisplayName)));
            }
            result = converter.Convert((FitnessType)20, null, null, null);
            Assert.Null(result);
            result = converter.Convert((FitnessSortOption)20, null, null, null);
            Assert.Null(result);
            result = converter.Convert(null, null, null, null);
            Assert.Null(result);
        }
[ Fact ] public void EnumViewModelConverter_Convert ( ) { EnumViewModelConverter converter = new EnumViewModelConverter ( ) ; List < Enum > enumValues = new List < Enum > ( ) ; enumValues . AddRange ( Enum . GetValues ( typeof ( FitnessType ) ) . Cast < Enum > ( ) ) ; enumValues . AddRange ( Enum . GetValues ( typeof ( FitnessSortOption ) ) . Cast < Enum > ( ) ) ; object result ; foreach ( Enum val in enumValues ) { result = converter . Convert ( val , null , null , null ) ; EnumViewModel viewModel = ( EnumViewModel ) result ; Assert . Equal ( val , viewModel . Value ) ; Assert . True ( ! ( String . IsNullOrEmpty ( viewModel . DisplayName ) ) ) ; } result = converter . Convert ( ( FitnessType ) 20 , null , null , null ) ; Assert . Null ( result ) ; result = converter . Convert ( ( FitnessSortOption ) 20 , null , null , null ) ; Assert . Null ( result ) ; result = converter . Convert ( null , null , null , null ) ; Assert . Null ( result ) ; }
Tests that the  method works correctly.
Tests that the method works correctly .