ArgumentsExtensions
using NUnit.Framework.Interfaces;
using System.Runtime.CompilerServices;
using System.Threading;
namespace NUnit.Framework.Internal.Extensions
{
internal static class ArgumentsExtensions
{
public static bool LastArgumentIsCancellationToken([System.Runtime.CompilerServices.Nullable(new byte[] {
1,
2
})] this object[] arguments)
{
if (arguments.Length != 0)
return arguments[arguments.Length - 1]?.GetType() == typeof(CancellationToken);
return false;
}
[System.Runtime.CompilerServices.NullableContext(1)]
public static bool LastParameterAcceptsCancellationToken(this IParameterInfo[] parameters)
{
if (parameters.Length != 0)
return parameters[parameters.Length - 1].ParameterType == typeof(CancellationToken);
return false;
}
}
}