Here is a solution to the problem, use a flag to skip importing WixTools into the project by using an MSBuild reserved keyword MSBuildRuntimeType.
You have to modify .wixproj file as follows and also add the empty VSTest Target.
<Target Name="VSTest" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets" Condition="'$(MSBuildRuntimeType)' != 'Core' AND '$(WixTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets')" />
<Target Name="EnsureWixToolsetInstalled" Condition="'$(MSBuildRuntimeType)' != 'Core' AND '$(WixTargetsImported)' != 'true'">
<Error Text="The WiX Toolset v3.11 (or newer) build tools must be installed to build this project. To download the WiX Toolset, see http://wixtoolset.org/releases/" />
</Target>
You can then run the test using the following command line
dotnet test -v n --no-build