-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
Description
Describe the bug 🐞
When using RxSchedulers in a Unit Test scenario with the combination of Microsoft.Reactive.Testing.TestScheduler
and the With
extension method, it doesn't properly set the RxScheduler.MainThreadScheduler
and RxScheduler.TaskpoolScheduler
to the TestScheduler
. When looking at RxApp.MainThreadScheduler
and RxApp.TaskPoolScheduler
they are correctly set to TestScheduler
Step to reproduce
Create a unit test with a body like:
using Microsoft.Reactive.Testing;
using ReactiveUI.Testing;
using Xunit;
public class TestClass : ReactiveTest
{
[Fact]
public void Test()
{
// check RxApp MainThreadSheduler and TaskPoolScheduler
// and RxScheduler MainThreadScheduler and TaskpoolScheduler
// they all be be: System.Reactive.Concurrency.CurrentThreadScheduler
new TestScheduler().With(scheduler =>
{
// check RxApp MainThreadSheduler and TaskPoolScheduler
// they will be be be: Microsoft.Reactive.Testing.TestScheduler
// and RxScheduler MainThreadScheduler and TaskpoolScheduler
// they will be be: System.Reactive.Concurrency.CurrentThreadScheduler
});
}
}
In the body of that With
block RxApp schedulers are TestScheduler
but RxSchedulers are System.Reactive.Concurrency.DefaultScheduler
Expected behavior
TestScheduler should also be set on RxSchedulers when running in unit tests
Screenshots 🖼️
No response
IDE
Visual Studio Code
Operating system
macos
Version
No response
Device
No response
ReactiveUI Version
22.1.1
Additional information ℹ️
No response