예제 #1
0
        public JobStatus(QuantityOfWork total, QuantityOfWork completed, bool busy)
        {
            if (total < completed)
            {
                throw new ArgumentOutOfRangeException(nameof(total), $"{nameof(total)} < {nameof(completed)}");
            }

            if (total < QuantityOfWork.None)
            {
                throw new ArgumentOutOfRangeException(nameof(total), $"{nameof(total)} < {nameof(QuantityOfWork.None)}");
            }

            Total     = total ?? throw new ArgumentNullException(nameof(total));
            Completed = completed ?? throw new ArgumentNullException(nameof(completed));
            Busy      = busy;
        }
예제 #2
0
 public static JobStatus Create(QuantityOfWork total)
 => new JobStatus(total, QuantityOfWork.None, false);
예제 #3
0
 public static QuantityOfWork ClampOrdered(this QuantityOfWork work, QuantityOfWork lower, QuantityOfWork upper)
 => work <lower?lower : work> upper ? upper : work;
예제 #4
0
 public static QuantityOfWork Clamp(this QuantityOfWork work, QuantityOfWork first, QuantityOfWork second)
 => first < second?work.ClampOrdered(first, second) : work.ClampOrdered(second, first);