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

RSRP-288211: Unit Tests ignore NUnit TestCase with similar array arguments

$
0
0
Reporter Amni X (Amni.X) Amni X (Amni.X)
Created Feb 8, 2012 9:26:09 PM
Updated Feb 8, 2012 9:27:04 PM
Priority Normal
Type Bug
Fix versions No Fix versions
State Submitted
Assignee Victor Kropp (victor.kropp)
Subsystem Unit Testing
Affected versions 6.0, 6.1
Fixed in build No Fixed in build
Using ReShaper "Unit Test Sessions" runner.
On an NUnit [TestFixture], if the [TestCase] uses an array argument, then other cases with the same non-array arguments are ignored, as if they are duplicates.

Example.
    [TestFixture]
    public class TestEnumerableExtensions
    {
        [TestCase("Apple", new string[] { "Apple" })]
        [TestCase("Apple", new string[] { "Banana" })]
        [TestCase("Banana", new string[] { "Banana" })]
        public void ShouldGetFirstItemCorrectly(string expectedResult, IEnumerable<string> items)
        {
            var first = items.FirstOrDefault();
            Assert.AreEqual(expectedResult, first);
        }


In the runner it only lists 2 tests, even though there are 3:
  • ShouldGetFirstItemCorrectly("Apple", System.String[])
  • ShouldGetFirstItemCorrectly("Banana", System.String[])

If the tests are executed 'Run All', then the 2 tests succeed.
If the tests are executed 'Debug All', then all 3 tests are run and the 2nd fails as expected.
If the test project is executed under NUnit test harness, then all 3 tests are run and the 2nd fails as expected.
If a dummy argument is added to the tests, different value for each, then they all display.

Amni.

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

Viewing all articles
Browse latest Browse all 106942

Trending Articles



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