using System.Runtime.CompilerServices;
using ReactiveUI.Builder;
using ReactiveUI.Primitives.Concurrency;
// The bootstrap below installs process-global ReactiveUI schedulers, so these tests share mutable
// state whether they like it or not. Running them in parallel made assertions that depend on a
// command's IsExecuting having settled fail intermittently under load.
[assembly: CollectionBehavior(DisableTestParallelization = true)]
namespace AvParser.UI.Tests;
/// Initialises ReactiveUI once for the whole test assembly.
///
/// ReactiveUI 24 no longer self-initialises: WhenAnyValue throws
/// until the builder has run. In the app that happens
/// inside AppBuilder.UseReactiveUI(); here there is no Avalonia app, so a module
/// initialiser does it before any test constructs a view model.
///
internal static class ReactiveUiBootstrap
{
[ModuleInitializer]
internal static void Initialize() =>
RxAppBuilder
.CreateReactiveUIBuilder()
// No dispatcher exists in these tests, so anything ReactiveUI marshals internally
// must run inline rather than being queued onto a thread that never pumps.
.WithMainThreadScheduler(ImmediateSequencer.Instance)
.WithTaskPoolScheduler(ImmediateSequencer.Instance)
.WithCoreServices()
.BuildApp();
}