Quantcast
Channel: YouTrackReSharper (RSRP) - Bug and Issue Tracker
Viewing all articles
Browse latest Browse all 106942

RSRP-289052: Bug with parameterized NUnit test fixtures

$
0
0
Reporter Kevin (McGrath) Kevin (McGrath)
Created Mar 6, 2012 1:08:10 AM
Updated Mar 6, 2012 1:09:21 AM
Priority Normal
Type Unspecified
Fix versions No Fix versions
State Submitted
Assignee Unassigned
Subsystem No subsystem
Affected versions 6.1
Fixed in build No Fixed in build
There is a bug in the way that ReSharper 6.1 handles parameterized test fixtures when the parameter is a boolean type.

The following test does not work. The symptoms are various but it seems that ReSharper is confused about the parameters. Sometimes it only runs the tests with a parameter of 'true', other times it doesn't run any tests, reporting the test run as inconclusive. Once ReSharper has got itself into this confusion then the confusion seems to persist, even if I change the TestFixture to one that I know will run correctly in ReSharper .

My ReSharper settings are default except that I have disabled the shadow-copy feature. I don't know if that setting is relevant.

My version information:

JetBrains ReSharper 6.1 Full Edition
Build 6.1.37.86 on 2011-12-20T21:15:24

The first test class will not work. But the second one will. This second test fixture is how I finally (after many frustrated hours) found a workaround by changing the parameter type from bool to string. In order to apply the workaround, I need to apply the code change and then restart visual studio. If I don't restart VS then ReSharper seems to remember its confused state and stays confused. A bit like the developers who have to battle with this bug :)


Does not work
using System.Diagnostics;
using System.Globalization;
using NUnit.Framework;

namespace MoDoc.DataEngine.Tests
{
[TestFixture(true)]
[TestFixture(false)]
public class ResharperBugTest1
{
private bool _parameter;

public ResharperBugTest1(bool parameter)
{
_parameter = parameter;
}

[Test]
public void DummyTest()
{
Debug.WriteLine("Parameter=" + _parameter.ToString(CultureInfo.InvariantCulture));
}
}
}

Works
using System;
using System.Diagnostics;
using System.Globalization;
using NUnit.Framework;

namespace MoDoc.DataEngine.Tests
{
[TestFixture("true")]
[TestFixture("false")]
public class ResharperBugTest1
{
private bool _parameter;

public ResharperBugTest1(string parameter)
{
_parameter = Convert.ToBoolean(parameter);
}

[Test]
public void DummyTest()
{
Debug.WriteLine("Parameter=" + _parameter.ToString(CultureInfo.InvariantCulture));
}
}
}

Viewing all articles
Browse latest Browse all 106942

Trending Articles



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