using System.Runtime.CompilerServices; using ReactiveUI.Builder; namespace PLib.Tests; /// /// Brings ReactiveUI up before any test touches a view model. /// /// /// ReactiveUI 24 refuses to serve WhenAnyValue until it has been initialised, and the /// application does that in Program.Main — which a test host never runs. Only the core /// services are registered here: platform services are about dispatchers and bindings, and a /// view model under test has neither. /// internal static class ReactiveUiBootstrap { [ModuleInitializer] internal static void Initialize() => // BuildApp rather than Build: only the former marks ReactiveUI as initialised, and // that flag is exactly what WhenAnyValue checks. RxAppBuilder.CreateReactiveUIBuilder() .WithCoreServices() .BuildApp(); }