When running a Blazor app in the browser, many .NET methods will throw a PlatformNotSupportedException, for example, TcpClient.ConnectAsync(). This is fine, but I want to run unit tests that will catch these types of restrictions.
I have found that when running bUnit tests (within a default bUnit project), that executing TcpClient.ConnectAsync()does not throw an exception. This is not what I want; I don't want to be developing services that may call APIs that will pass at test-time but fail at run-time.
How can I run unit tests that intentionally have the same restrictions that would exist in an app running in the browser?