/// <summary> /// Throws an <see cref="InvalidOperationException"/> if the specified <paramref name="package"/> is not a valid <see cref="DurianPackage"/> value. /// </summary> /// <param name="package"><see cref="DurianPackage"/> to ensure that is valid.</param> /// <exception cref="InvalidOperationException">Unknown <see cref="DurianPackage"/> value: <paramref name="package"/>.</exception> public static void EnsureIsValidPackageEnum(DurianPackage package) { if (!GlobalInfo.IsValidPackageValue(package)) { throw new InvalidOperationException($"Unknown {nameof(DurianPackage)} value: {package}!"); } }
/// <summary> /// Includes the specified <paramref name="module"/> in the container. /// </summary> /// <param name="module"><see cref="DurianModule"/> to include.</param> /// <exception cref="ArgumentException"><paramref name="module"/> is not a valid <see cref="DurianModule"/> value.</exception> public void Include(DurianModule module) { if (!GlobalInfo.IsValidModuleValue(module)) { throw new ArgumentException($"Value '{module}' is not a valid {nameof(DurianModule)} value!", nameof(module)); } _enums.Add(module); _references.Add(null); }
/// <summary> /// Includes the specified <paramref name="package"/> in the container. /// </summary> /// <param name="package"><see cref="DurianPackage"/> to include.</param> /// <exception cref="ArgumentException"><paramref name="package"/> is not a valid <see cref="DurianPackage"/> value.</exception> public void Include(DurianPackage package) { if (!GlobalInfo.IsValidPackageValue(package)) { throw new ArgumentException($"Value '{package}' is not a valid {nameof(DurianPackage)} value!", nameof(package)); } _enums.Add(package); _references.Add(null); }
/// <summary> /// Throws an <see cref="InvalidOperationException"/> if the specified <paramref name="module"/> is not a valid <see cref="DurianModule"/> value. /// </summary> /// <param name="module"><see cref="DurianModule"/> to ensure that is valid.</param> /// <exception cref="InvalidOperationException">Unknown <see cref="DurianModule"/> value detected. -or- <see cref="DurianModule.None"/> is not a valid Durian module.</exception> public static void EnsureIsValidModuleEnum(DurianModule module) { if (module == DurianModule.None) { throw new InvalidOperationException($"{nameof(DurianModule)}.{nameof(DurianModule.None)} is not a valid Durian module!"); } if (!GlobalInfo.IsValidModuleValue(module)) { throw new InvalidOperationException($"Unknown {nameof(DurianModule)} value: {module}!"); } }