in src/Testing/Emulator/Policies/ArgumentsExtensions.cs [23:41]
public static T? ExtractOptionalArgument<T>(this object?[]? args) where T : class
{
if (args is null)
{
return null;
}
if (args is not { Length: 1 })
{
throw new ArgumentException("Expected only 1 argument", nameof(args));
}
if (args[0] is not null && args[0] is not T)
{
throw new ArgumentException($"Expected {typeof(T).Name} as first argument", nameof(args));
}
return args[0] as T;
}