Exemple #1
0
 public void IsValid_ReturnsSameResultAsIsValidFlagCombination_WhenUsingFlagEnum()
 {
     for (int i = sbyte.MinValue; i <= sbyte.MaxValue; ++i)
     {
         var value = (ColorFlagEnum)i;
         Assert.AreEqual(FlagEnums.IsValidFlagCombination(value), value.IsValid());
     }
 }
Exemple #2
0
 public void IsValidFlagCombination_Test()
 {
     for (int i = sbyte.MinValue; i <= sbyte.MaxValue; ++i)
     {
         if (i >= 0 && i <= 15)
         {
             Assert.IsTrue(FlagEnums.IsValidFlagCombination((ColorFlagEnum)i));
         }
         else
         {
             Assert.IsFalse(FlagEnums.IsValidFlagCombination((ColorFlagEnum)i));
         }
     }
 }
Exemple #3
0
 public bool IsValid(DayType value) => value.GetFlagCount(DayType.Weekday | DayType.Weekend) == 1 && FlagEnums.IsValidFlagCombination(value);
 public bool IsValid(DayType value) => value.HasAnyFlags(DayType.Weekday | DayType.Weekend) && !value.HasAllFlags(DayType.Weekday | DayType.Weekend) && FlagEnums.IsValidFlagCombination(value);