Beispiel #1
0
        public void GetNames()
        {
            var expect = Enum.GetNames(typeof(TEnum));
            var actual = FastEnum.GetNames <TEnum>();

            actual.Should().BeEquivalentTo(expect);
        }
Beispiel #2
0
        public void GetNames()
        {
            var expect = new[]
            {
                nameof(TEnum.MinValue),
                nameof(TEnum.MaxValue),
            };
            var actual = FastEnum.GetNames <TEnum>();

            actual.Should().BeEquivalentTo(expect);
        }
Beispiel #3
0
 public void GetNames()
 => FastEnum.GetNames <TEnum>().Should().BeEmpty();
Beispiel #4
0
 public IEnumerable <string> GetModeList() => FastEnum.GetNames <Modes>().Skip(1);
Beispiel #5
0
 public IEnumerable <string> GetTransportTypeList() => FastEnum.GetNames <TransportType>();
Beispiel #6
0
 /// <summary>
 /// Asserts that this enumeration instance is a valid <typeparamref name="T"/> value..
 /// </summary>
 /// <typeparam name="T">The type of the enumeration.</typeparam>
 /// <param name="assert">This <see cref="Asserter{T}"/>.</param>
 /// <returns>This <paramref name="assert"/>.</returns>
 public static Asserter <T> Valid <T>(this Asserter <T> assert) where T : struct, Enum
 {
     if (!FastEnum.IsDefined(assert.Actual))
     {
         throw new AssertException($"The instance was not valid.\nActual: {assert.Actual}\nExpected one of: {FastEnum.GetNames<T>().Aggregate((total, next) => total + ", " + next)}");
     }
     return(assert);
 }