Skip to content

Commit

Permalink
Merge pull request nunit#1157 from nunit/issue-1118
Browse files Browse the repository at this point in the history
Add test of TestFixtureSource to verify fix nunit#1118
  • Loading branch information
rprouse committed Dec 23, 2015
2 parents 9a6c91c + 96fb642 commit 9dce52f
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
56 changes: 56 additions & 0 deletions src/NUnitFramework/testdata/TestFixtureSourceData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,62 @@ static IEnumerable ExplicitData()
}
}

[TestFixture]
public abstract class Issue1118_Root
{
protected readonly string Browser;

protected Issue1118_Root(string browser)
{
Browser = browser;
}

[SetUp]
public void Setup()
{
}
}

[TestFixtureSource(typeof(Issue1118_SourceData))]
public class Issue1118_Base : Issue1118_Root
{
public Issue1118_Base(string browser) : base(browser)
{
}

[TearDown]
public void Cleanup()
{
}
}

public class Issue1118_Fixture : Issue1118_Base
{
public Issue1118_Fixture(string browser) : base(browser)
{
}

[Test]
public void DoSomethingOnAWebPageWithSelenium()
{
}

[Test]
public void DoSomethingElseOnAWebPageWithSelenium()
{
}
}

public class Issue1118_SourceData : IEnumerable
{
public IEnumerator GetEnumerator()
{
yield return "Firefox";
yield return "Chrome";
yield return "Internet Explorer";
}
}

#region Source Data Classes

class SourceData_IEnumerable : IEnumerable
Expand Down
9 changes: 9 additions & 0 deletions src/NUnitFramework/tests/Attributes/TestFixtureSourceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,14 @@ public void CanMarkIndividualFixturesExplicit()
Assert.That(suite.Tests[1].Properties.Get(PropertyNames.SkipReason), Is.EqualTo("Runs long"));
Assert.That(suite.Tests[2].RunState, Is.EqualTo(RunState.Explicit));
}

[Test]
public void Issue1118()
{
TestSuite suite = TestBuilder.MakeFixture(typeof(Issue1118_Fixture));
Assert.That(suite.RunState, Is.EqualTo(RunState.Runnable));
Assert.That(suite.Tests.Count, Is.EqualTo(3));
Assert.That(suite.TestCaseCount, Is.EqualTo(6));
}
}
}

0 comments on commit 9dce52f

Please sign in to comment.