using System;

namespace Wayne.Lib
{
    public static class ParamGuard
    {
        public static void AssertIsNotNull<T>(T paramValue, string paramName) where T : class
        {
            if (paramValue == null)
            {
                throw new ArgumentNullException(paramName);
            }
        }

        public static void AssertMeetsCondition<T>(T paramValue, Func<T, bool> paramChecker, string paramName, string conditionName)
        {
            if (!paramChecker(paramValue))
            {
                throw new ArgumentException(string.Format("Parameter {0} does not meet condition {1} ", paramName, conditionName));
            }
        }
    }
}