This was corrected with the 2.5.2 release but the older docs on the web site had not been updated.
** Changed in: nunitv2 Importance: Undecided => Low ** Changed in: nunitv2 Status: New => Fix Released ** Changed in: nunitv2 Assignee: (unassigned) => Charlie Poole (charlie.poole) -- Documentation example for TestCaseData.Returns is wrong https://bugs.launchpad.net/bugs/520972 You received this bug notification because you are a member of NUnit Developers, which is subscribed to NUnit V2. Status in NUnit V2 Test Framework: Fix Released Bug description: http://nunit.org/index.php?p=testCaseSource&r=2.5 says: instances from a data source in a separately defined class. [TestFixture] public class MyTests { [Test,TestCaseSource(typeof(MyFactoryClass),"TestCases")] public void DivideTest(int n, int d) { return n/d; } ... } public class MyFactoryClass { public static IEnumerable TestCases { get { yield return new TestCaseData( 12, 3 ).Returns( 4 ); yield return new TestCaseData( 12, 2 ).Returns( 6 ); yield return new TestCaseData( 12, 4 ).Returns( 3 ); yield return new TestCaseData( 0, 0 ) .Throws(typeof(DivideByZeroException)) .SetName("DivideByZero") .SetDescription("An exception is expected"); } } } Note that this code will not work, because for the .Returns method to work the testcase must actually return something. In this example the test case returns void. To fix: change: public void DivideTest(int n, int d) to read: public int DivideTest(int n, int d) _______________________________________________ Mailing list: https://launchpad.net/~nunit-core Post to : nunit-core@lists.launchpad.net Unsubscribe : https://launchpad.net/~nunit-core More help : https://help.launchpad.net/ListHelp