Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Blazor unit testing with browser restrictions

$
0
0

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?


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>