From 40dc70e8c7ce1612142fa92c9c8f882e003bc745 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Domeradzki?= Date: Sun, 22 Sep 2024 20:42:44 +0200 Subject: [PATCH] Misc --- ArchiSteamFarm.Tests/Bot.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ArchiSteamFarm.Tests/Bot.cs b/ArchiSteamFarm.Tests/Bot.cs index a98264c5d..1ab618477 100644 --- a/ArchiSteamFarm.Tests/Bot.cs +++ b/ArchiSteamFarm.Tests/Bot.cs @@ -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(); - 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)); }