Beispiel #1
0
 /// <summary>
 ///     Gets the namespace.
 /// </summary>
 /// <value>The namespace.</value>
 public static string GetNamespace(this GuardEnum value)
 {
     return(value switch {
         GuardEnum.TIMER_WITHIN => "timer",
         GuardEnum.TIMER_WITHINMAX => "timer",
         GuardEnum.WHILE_GUARD => "internal",
         _ => throw new ArgumentException()
     });
Beispiel #2
0
        /// <summary>
        /// Gets the name.
        /// </summary>
        /// <value>The name.</value>
        public static string GetName(this GuardEnum value)
        {
            switch (value)
            {
            case GuardEnum.TIMER_WITHIN:
                return("within");

            case GuardEnum.TIMER_WITHINMAX:
                return("withinmax");

            case GuardEnum.WHILE_GUARD:
                return("while");
            }

            throw new ArgumentException();
        }
Beispiel #3
0
        /// <summary>
        /// Gets the namespace.
        /// </summary>
        /// <value>The namespace.</value>
        public static string GetNamespace(this GuardEnum value)
        {
            switch (value)
            {
            case GuardEnum.TIMER_WITHIN:
                return("timer");

            case GuardEnum.TIMER_WITHINMAX:
                return("timer");

            case GuardEnum.WHILE_GUARD:
                return("internal");
            }

            throw new ArgumentException();
        }
Beispiel #4
0
        /// <summary>
        /// Gets the class associated with the guard enum.
        /// </summary>
        /// <param name="guardEnum">The guard enum.</param>
        /// <returns></returns>
        public static Type GetClazz(this GuardEnum guardEnum)
        {
            switch (guardEnum)
            {
            case GuardEnum.TIMER_WITHIN:
                return(typeof(TimerWithinGuardFactory));

            case GuardEnum.TIMER_WITHINMAX:
                return(typeof(TimerWithinOrMaxCountGuardFactory));

            case GuardEnum.WHILE_GUARD:
                return(typeof(ExpressionGuardFactory));
            }

            throw new ArgumentException("invalid value", "guardEnum");
        }