New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NNnit3 "no test found to run" when ctor throws or protected #754
Comments
JFI, NUnitTestAdapter might be quite unstable. |
@sm-g I've just tested your case using the following code: public class User
{
public User(int id)
{
if (id < 1)
throw new ArgumentOutOfRangeException();
}
}
public class MappedUser
{
protected MappedUser(int id, string name) {}
public static MappedUser Create()
{
return null;
}
}
public class Tests
{
[Test, AutoData]
public void UserTest(User user)
{
}
[Test, AutoData]
public void MappedUserTest(MappedUser user)
{
}
} My setup:
I've opened the VS Test window and run all the tests. Result: Notice, we know about the issue that VS runner cannot handle test cases with dynamic test name. See PR #709 for more detail. Could you please verify:
|
@sm-g Any chance to review my answer? So we could decide what to do with this issue.. |
Using you code, I got FileNotFound exception ("nunit.framework, Version=3.0.5797.27539, Culture=neutral, PublicKeyToken=2638cd05610744eb") when run tests with testdriven.net, and nothing in TestExplorer. my setups as yours, and AutoFixture.NUnit3 - 3.51.0 However, when I remove any conditions from |
@sm-g Could you please attach the solution that causes the issue? Also specify the version of VS you use. I don't have |
VS 15.4 |
@sm-g Thanks for sharing the project. That happens because AssemblyBinding redirection generation is disabled in your project. That is not something specific to AutoFixture product itself - rather to how the .NET works. To fix the issue add the following statements to the csproj file: <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{BE1E2536-4D83-428B-9760-54A135A71164}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>AutoFixtureRepro</RootNamespace>
<AssemblyName>AutoFixtureRepro</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<!-- Enable binding redirection generation -->
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
</PropertyGroup>
... After that everything will work fine. If you change the Let me know whether now the original issue is solved. |
Yes, thanks for that |
Given classes
and tests with
AutoData
using them.NUnit3 test adapter and ctrl+R, ctrl+T does not show such tests. So I can write many tests, then change something in ctor and everything will be "ok".
I expected them to be visible and failing when try to run.
The text was updated successfully, but these errors were encountered: