using System.Runtime.CompilerServices;
using ReactiveUI.Builder;
using ReactiveUI.Primitives.Concurrency;
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();
}