using RadicadeServer.Utils;
using Xunit;
namespace RadicadeServer.Tests;
///
/// RoomUtils/MatchmakingUtils expose their DbContext factories as process-wide statics, so
/// two test classes that replace them cannot run at the same time - whichever wins would
/// answer the other's queries. xUnit parallelizes classes by default, which made the suite
/// fail depending on scheduling; membership in this collection serializes those classes.
///
[CollectionDefinition(Name)]
public class DbFactoryCollection : ICollectionFixture
{
public const string Name = "SharesDbFactoryStatics";
}
///
/// The registration throttle is process-wide state. This suite creates dozens of accounts from
/// loopback using the same handful of device ids, so without this the run would spend itself
/// refusing its own fixtures and prove nothing about registration. The limits themselves are
/// covered on their own terms by AccountRegistrationTests, which sets its own and puts them back.
///
public sealed class RegistrationThrottleFixture
{
public RegistrationThrottleFixture() =>
RegistrationGuard.Configure(
maxCreationsPerIp: int.MaxValue,
maxCreationsPerDevice: int.MaxValue,
minimumDeviceInterval: TimeSpan.Zero);
}