/// <summary> /// Allocates new validation state without errors. /// If validation succeeds the Validate method succession shall return a copy of this state /// </summary> /// <param name="targetName">The target name to perform validation under. Controls attribute/metadata selection</param> /// <param name="mode">A hint specifying whether the system shall break on the first error or continue with error batch</param> /// <param name="errorLimit">Sets an approximate limit for total error count generated by validation in batch mode</param> public ValidState(string targetName, ValidErrorMode mode, int errorLimit = DEFAULT_ERROR_LIMIT) { TargetName = targetName ?? TargetedAttribute.ANY_TARGET; Mode = mode; Error = null; ErrorLimit = IntUtils.MinMax(1, errorLimit, MAX_ERROR_LIMIT); }
public void MinMaxTest() { Aver.AreEqual(1, IntUtils.MinMax(-1, 1, 3)); Aver.AreEqual(2, IntUtils.MinMax(2, 2, 3)); Aver.AreEqual(3, IntUtils.MinMax(2, 3, 3)); Aver.AreEqual(-1, IntUtils.MinMax(-1, -10, 3)); Aver.AreEqual(3, IntUtils.MinMax(-1, 5, 3)); Aver.Throws <AzosException>(() => IntUtils.MinMax(10, 5, 3)); }