I notice when I start up Visual Studio 2019, I am unable to create a .NET Framework version of XUnit or NUnit (only MSTests). We have been mandated to use XUnit tests, but our solution is all .NET Framework. Some of the nuget packages are dependent on being .NET Framework (for Sitecore 8.2) and thus I can't add them to a .NET Core project. I cannot upgrade any of the legacy project to .NET Core or to Sitecore 9+ at this time.
How do I add in a .NET Framework XUnit project? Is there something wrong with my Visual Studio setup? Is it not supported? I have been unable to find documentation from Microsoft about this. Thanks.
It's an open source unit testing tool for . Net framework that's compatible with ReSharper, CodeRush, TestDriven.Net, and Xamarin. You can take advantage of xUnit.Net to assert an exception type easily.
Sometimes, you want to write tests and ensure they run against several target application platforms. The xUnit.net test runner that we've been using supports . NET Core 1.0 or later, . NET 5.0 or later, and .
First use the xUnit Test Project (.NET Core)
project template.
Then go edit the .csproj file and change <TargetFramework>netcoreapp2.2</TargetFramework>
to <TargetFramework>net462</TargetFramework>
.
That's it. :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With