예제 #1
0
 public TestSmartEnum SmartEnum_TryFromName_Invalid_IgnoreCase()
 {
     if (TestSmartEnum.TryFromName("Invalid", true, out var result))
     {
         return(result);
     }
     return(null);
 }
예제 #2
0
 public TestSmartEnum SmartEnum_TryFromName_Ten()
 {
     if (TestSmartEnum.TryFromName("Ten", false, out var result))
     {
         return(result);
     }
     return(null);
 }
예제 #3
0
 public TestSmartEnum SmartEnum_TryFromName_Invalid()
 {
     if (TestSmartEnum.TryFromName("Invalid", false, out var result))
     {
         return(result);
     }
     return(null);
 }
예제 #4
0
 public TestSmartEnum SmartEnum_TryFromValue_10()
 {
     if (TestSmartEnum.TryFromValue(10, out var result))
     {
         return(result);
     }
     return(null);
 }
예제 #5
0
 public TestSmartEnum SmartEnum_FromName_Invalid_IgnoreCase()
 {
     try
     {
         return(TestSmartEnum.FromName("Invalid", true));
     }
     catch (SmartEnumNotFoundException)
     {
         return(null);
     }
 }
예제 #6
0
 public TestSmartEnum SmartEnum_FromName_Invalid()
 {
     try
     {
         return(TestSmartEnum.FromName("Invalid", false));
     }
     catch (SmartEnumNotFoundException)
     {
         return(null);
     }
 }
예제 #7
0
        public TestSmartEnum SmartEnum_When()
        {
            TestSmartEnum result = null;

            TestSmartEnum.Ten
            .When(TestSmartEnum.One).Then(() => result   = TestSmartEnum.One)
            .When(TestSmartEnum.Two).Then(() => result   = TestSmartEnum.Two)
            .When(TestSmartEnum.Three).Then(() => result = TestSmartEnum.Three)
            .When(TestSmartEnum.Four).Then(() => result  = TestSmartEnum.Four)
            .When(TestSmartEnum.Five).Then(() => result  = TestSmartEnum.Five)
            .When(TestSmartEnum.Six).Then(() => result   = TestSmartEnum.Six)
            .When(TestSmartEnum.Seven).Then(() => result = TestSmartEnum.Seven)
            .When(TestSmartEnum.Eight).Then(() => result = TestSmartEnum.Eight)
            .When(TestSmartEnum.Nine).Then(() => result  = TestSmartEnum.Nine)
            .When(TestSmartEnum.Ten).Then(() => result   = TestSmartEnum.Ten)
            .Default(() => throw new Exception());

            return(result);
        }
예제 #8
0
 public TestSmartEnum SmartEnum_FromName_ten_IgnoreCase() => TestSmartEnum.FromName("ten", true);
예제 #9
0
 public TestSmartEnum SmartEnum_FromName_one_IgnoreCase() => TestSmartEnum.FromName("one", true);
예제 #10
0
 public TestSmartEnum SmartEnum_FromName_Ten() => TestSmartEnum.FromName("Ten", false);
예제 #11
0
 public TestSmartEnum SmartEnum_FromName_One() => TestSmartEnum.FromName("One", false);
예제 #12
0
 public TestSmartEnum SmartEnum_FromValue_10() => TestSmartEnum.FromValue(10);