This commit is contained in:
Łukasz Domeradzki 2024-09-22 20:42:44 +02:00
parent 5cc684f4b6
commit 40dc70e8c7
No known key found for this signature in database
GPG key ID: 6B138B4C64555AEA

View file

@ -41,7 +41,9 @@ namespace ArchiSteamFarm.Tests;
#pragma warning disable CA1812 // False positive, the class is used during MSTest
[TestClass]
internal sealed class Bot {
internal static Steam.Bot GenerateBot() {
internal static Steam.Bot GenerateBot(string botName = "Test") {
ArgumentException.ThrowIfNullOrEmpty(botName);
ConstructorInfo? constructor = typeof(Steam.Bot).GetConstructor(BindingFlags.Instance | BindingFlags.NonPublic, [typeof(string), typeof(BotConfig), typeof(BotDatabase)]);
if (constructor == null) {
@ -64,7 +66,7 @@ internal sealed class Bot {
ASF.GlobalDatabase ??= emptyObject.ToJsonObject<GlobalDatabase>();
if (constructor.Invoke(["Test", botConfig, botDatabase]) is not Steam.Bot result) {
if (constructor.Invoke([botName, botConfig, botDatabase]) is not Steam.Bot result) {
throw new InvalidOperationException(nameof(result));
}