I'm using xUnit and ReactiveUI 11.2 (for WPF, .NET Framework 4.8, but I think my question is more generic).

Basically, I want to test my `ReactiveCommand` in the ViewModels. 

For instance, there was some condition that threw an exception in my code, and my program crashes.

I want to make a unit test to reproduce this error (the unit test should fail), then I'll fix my bug, prevent somehow the exception, and then my test should pass to reflect the fix. (pretty standard procedure).

The problem is, any exception thrown during a ReactiveCommand seem to be "swallowed" by ReactiveUI, **the exception does not make the test fail**.

Also, the same happens if I try to write `Assert()` statements in the callback of `.Subscribe()` : I can see during debug that my assertion fail properly, but the test is marked in green as "passed" anyway.

I tried different way by playing a bit with the schedulers, doesn't improve anything.
I tried to use ".ThrownExceptions" as described doesn't help either.

Some documentation here : <https://reactiveui.net/docs/handbook/testing/>

---

TL;DR
=====

How can I make exceptions in my `ReactiveCommand`s cause my unit tests to fail ? How am I supposed to unit tests `ReactiveCommand`s entirely ?

---

Below is a complete program that demonstrate the issue. 

Use with NuGet packages :
xunit 2.4.1, 
xunit.runner.visualstudio 2.4.1, 
ReactiveUI.Testing 11.2.1

```
using Microsoft.Reactive.Testing;
using ReactiveUI;
using ReactiveUI.Testing;
using System;
using System.Reactive;
using System.Reactive.Concurrency;
using System.Reactive.Linq;
using Xunit;

namespace Tests
{
    public class Foo
    {

        public ReactiveCommand<Unit, Unit> TestCommand { get; }

        public Foo(IScheduler? scheduler = null)
        {
            scheduler ??= RxApp.MainThreadScheduler;

            TestCommand = ReactiveCommand.Create(Explode, canExecute: null, outputScheduler: scheduler);
        }

        public void Explode()
        {
            throw new Exception("Boom");
        }
    }

    public class ReactiveCommandTests
    {

        // Should fail? (it doesn't fail)
        [Fact]
        public void Test1()
        {
            var foo = new Foo();
            foo.TestCommand.Execute().Subscribe();
        }

        // Should fail (it fails alright ! no ReactiveUI Observable here...)
        [Fact]
        public void Test2()
        {
            var foo = new Foo();
            foo.Explode();
        }

        // Should fail? (it doesn't fail)
        [Fact]
        public void Test3()
        {
            var testScheduler = new TestScheduler();
            var foo = new Foo(testScheduler);
            foo.TestCommand.Execute().Subscribe();
        }

        // Should fail? (it doesn't fail)
        [Fact]
        public void Test4()
        {
            new TestScheduler().With(scheduler =>
            {
                var foo = new Foo(scheduler);
                foo.TestCommand.Execute().Subscribe();

            });
        }

        // Should fail ? (it doesn't fail)
        [Fact]
        public void Test5()
        {
            var foo = new Foo();
            foo.TestCommand.ThrownExceptions.Subscribe(
                (ex) => {
                    Console.WriteLine("Exception detected !");
                    Assert.False(true); // This is hit, but doesn't even make the test fail....
                });

            foo.TestCommand.Execute().Subscribe();
        }
    }
}

```

All the tests cause the exception to be thrown, all tests should fail IMO, but only the one *not using* the `ReactiveCommand is failing.

[![Test results that shows 4 over 5 pass instead of 0 over 5](https://i.stack.imgur.com/ndzhY.png)](https://i.stack.imgur.com/ndzhY.png)