Run your xunit-based tests on an STA thread with the WPF Dispatcher, a WinForms SynchronizationContext, or even a cross-platform generic UI thread emulation with a SynchronizationContext that keeps code running on a "main thread" for that test.
Xunit.StaFact is a powerful NuGet package designed to enhance the testing experience for applications that rely on Single Threaded Apartment (STA) threads, such as WPF and WinForms. With the potential to run tests on a main thread that closely resembles real-world UI scenarios, this package allows developers to ensure their applications perform seamlessly. The transition from xUnit v2 to v3 brings numerous enhancements, making it vital for developers to adapt their test structures accordingly.
This package supports an array of attributes tailored for different testing environments, empowering users to write effective parameterized tests with ease. Whether you're working within a Windows ecosystem or leveraging cross-platform capabilities, Xunit.StaFact caters to your testing needs to ensure robust applications.