mirror of
https://github.com/JustArchiNET/ArchiSteamFarm
synced 2024-11-14 00:47:25 +00:00
Misc
This commit is contained in:
parent
5cc684f4b6
commit
40dc70e8c7
1 changed files with 4 additions and 2 deletions
|
@ -41,7 +41,9 @@ namespace ArchiSteamFarm.Tests;
|
||||||
#pragma warning disable CA1812 // False positive, the class is used during MSTest
|
#pragma warning disable CA1812 // False positive, the class is used during MSTest
|
||||||
[TestClass]
|
[TestClass]
|
||||||
internal sealed class Bot {
|
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)]);
|
ConstructorInfo? constructor = typeof(Steam.Bot).GetConstructor(BindingFlags.Instance | BindingFlags.NonPublic, [typeof(string), typeof(BotConfig), typeof(BotDatabase)]);
|
||||||
|
|
||||||
if (constructor == null) {
|
if (constructor == null) {
|
||||||
|
@ -64,7 +66,7 @@ internal sealed class Bot {
|
||||||
|
|
||||||
ASF.GlobalDatabase ??= emptyObject.ToJsonObject<GlobalDatabase>();
|
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));
|
throw new InvalidOperationException(nameof(result));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue