fix: Fixes flaky tests, formatting, and sequential testing. (#2168)

This commit is contained in:
Kamron Batman 2025-04-30 16:42:38 -07:00 • committed by GitHub
parent 415c7a6bfd
commit 7dbfc9d161
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
60 changed files with 1304 additions and 1289 deletions

View file

@ -0,0 +1,56 @@
using System;
using System.Reflection;
using Server.Misc;
using Xunit;
namespace Server.Tests;
[CollectionDefinition("Sequential UOContent Tests", DisableParallelization = true)]
public class UOContentFixture : ICollectionFixture<UOContentFixture>, IDisposable
{
public UOContentFixture()
{
Core.ApplicationAssembly = Assembly.GetExecutingAssembly();
Core.LoopContext = new EventLoopContext();
Core.Expansion = Expansion.EJ;
// Load Configurations
ServerConfiguration.Load(true);
// Load UOContent.dll into the type resolver
ServerConfiguration.AssemblyDirectories.Add(Core.BaseDirectory);
AssemblyHandler.LoadAssemblies(["Server.dll", "UOContent.dll"]);
// Load Skills
SkillsInfo.Configure();
// Configure / Initialize
TestMapDefinitions.ConfigureTestMapDefinitions();
// Configure the world
World.Configure();
Timer.Init(0);
// Configure Races
RaceDefinitions.Configure();
// Load the world
World.Load();
World.ExitSerializationThreads();
}
private static int _counter;
public void Dispose()
{
_counter++;
if (_counter > 1)
{
throw new Exception("NO!");
}
Timer.Init(0);
}
}