Skip to content

Commit

Permalink
Rename Helper.cs into Guard.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
Evangelink committed Jul 10, 2023
1 parent 0ee0586 commit 4d52f05
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 53 deletions.
4 changes: 2 additions & 2 deletions src/TestFramework/TestFramework.Extensions/PrivateObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public PrivateObject(string assemblyName, string typeName, Type[]? parameterType
public PrivateObject(Type type, params object?[]? args)
: this(type, null, args)
{
Helper.CheckParameterNotNull(type, "type", string.Empty);
Guard.IsNotNull(type, "type", string.Empty);
}

/// <summary>
Expand All @@ -108,7 +108,7 @@ public PrivateObject(Type type, params object?[]? args)
/// <param name="args">Arguments to pass to the constructor.</param>
public PrivateObject(Type type, Type[]? parameterTypes, object?[]? args)
{
Helper.CheckParameterNotNull(type, "type", string.Empty);
Guard.IsNotNull(type, "type", string.Empty);
object? o;
if (parameterTypes != null)
{
Expand Down
35 changes: 35 additions & 0 deletions src/TestFramework/TestFramework/Internal/Guard.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;

namespace Microsoft.VisualStudio.TestTools.UnitTesting;

/// <summary>
/// A guard helper class to help validate preconditions.
/// </summary>
internal static class Guard
{
internal static void IsNotNull(object? param, string parameterName, string? message)
{
if (param is not null)
{
return;
}

if (message is null)
{
throw new ArgumentNullException(parameterName);
}

throw new ArgumentNullException(parameterName, message);
}

internal static void IsNotNullOrEmpty(string? argument, string parameterName, string message)
{
if (StringEx.IsNullOrEmpty(argument))
{
throw new ArgumentException(message, parameterName);
}
}
}
51 changes: 0 additions & 51 deletions src/TestFramework/TestFramework/Internal/Helper.cs

This file was deleted.

0 comments on commit 4d52f05

Please sign in to comment.