Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -314,11 +314,7 @@ public override void FilterByAssociatedInstance(object associatedInstance, strin
/// <param name="optionValue"></param>
public override void AddQueryOption(string optionName, object optionValue)
{
if (string.IsNullOrEmpty(optionName))
{
throw new ArgumentNullException(nameof(optionName));
}

ArgumentException.ThrowIfNullOrEmpty(optionName);
ArgumentNullException.ThrowIfNull(optionValue);

this.queryOptions[optionName] = optionValue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ internal static string WqlQueryAll(string from)
/// </remarks>
internal static T GetFirst<T>(CimSession session, string nameSpace, string wmiClassName) where T : class, new()
{
if (string.IsNullOrEmpty(wmiClassName))
throw new ArgumentException("String argument may not be null or empty", nameof(wmiClassName));
ArgumentException.ThrowIfNullOrEmpty(wmiClassName);

try
{
Expand Down Expand Up @@ -132,9 +131,8 @@ internal static string WqlQueryAll(string from)
/// </remarks>
internal static T[] GetAll<T>(CimSession session, string nameSpace, string wmiClassName) where T : class, new()
{
if (string.IsNullOrEmpty(wmiClassName))
throw new ArgumentException("String argument may not be null or empty", nameof(wmiClassName));

ArgumentException.ThrowIfNullOrEmpty(wmiClassName);

var rv = new List<T>();

try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,19 +186,21 @@ protected override void ProcessRecord()
{
bool result = false;

if (path == null)
{
WriteError(new ErrorRecord(
new ArgumentNullException(TestPathResources.PathIsNullOrEmptyCollection),
"NullPathNotPermitted",
ErrorCategory.InvalidArgument,
Path));
continue;
}

if (string.IsNullOrWhiteSpace(path))
{
WriteObject(result);
if (path is null)
{
WriteError(new ErrorRecord(
new ArgumentNullException(TestPathResources.PathIsNullOrEmptyCollection),
"NullPathNotPermitted",
ErrorCategory.InvalidArgument,
Path));
}
else
{
WriteObject(result);
}

continue;
}

Expand Down