Re: Invalid SetUp method signature
"Kelly Anderson" <[email protected]> Wed, 6 Aug 2008 15:50:59 -0600
| Newsgroups | gmane.comp.windows.dotnet.nunit.devel |
|---|---|
| Message-ID | <[email protected]> |
Ok everyone, I was trying to reproduce the issue in a smaller project
to report the "bug"... and it seems to be a different issue than what
I initially thought. Here is the smallest code that causes a problem.
It would seem that SetUpFixture is doing validation that wasn't done
in 2.4.6... and because it's internal and the setup function is
private, it's failing. But I am pretty sure this worked in 2.4.6,
although I'm not 100% sure of that... weirdness.
Anyway, if I had to turn this into a request it would be for a more
meaningful message... something like "[SetUpFixture] Setup's
RunBeforeAnyTests function must be public" would be nice..." :-) The
current message is just a little to generic to be terribly helpful in
this situation.
using NUnit.Framework;
using NUnit.Framework.Syntax.CSharp;
namespace TestCaseBug
{
[TestFixture]
public class Tests
{
[SetUp]
public void setup()
{
}
[Test]
public void itWorks()
{
Assert.That(true, Is.True);
}
}
/// <summary>
/// This sets up the global environment for running tests.
/// </summary>
[SetUpFixture]
internal class Setup
{
[SetUp]
private void RunBeforeAnyTests()
{
}
[TearDown]
private void RunAfterAnyTests()
{
}
}
}
-Kelly
On Wed, Aug 6, 2008 at 2:22 PM, Charlie Poole
<[email protected]> wrote:
> I can't see why this would be at first glance, so please
> file a bug. It would be useful to know if this only happens
> when there is a single TestCase as opposed to more.
>
> Charlie
>
>> -----Original Message-----
>> From: [email protected]
>> [mailto:[email protected]] On
>> Behalf Of Kelly Anderson
>> Sent: Wednesday, August 06, 2008 11:14 AM
>> To: [email protected]
>> Subject: [nunit-developer] Invalid SetUp method signature
>>
>> Hi folks, I'm using the 2.5 alpha, and got this message
>> running my test case.
>>
>> Reason: Invalid SetUp method signature
>>
>> Here's my code:
>>
>> using NUnit.Framework;
>> using NUnit.Framework.SyntaxHelpers;
>> using Sonic.IC5;
>>
>> namespace IC5Test
>> {
>> [TestFixture]
>> public class ProfileConfigTests
>> {
>> private IDataMap _map;
>>
>> [SetUp]
>> public void setup()
>> {
>> FileState fileState = FileState.GetFileState();
>> MockDirectory.SetTestRoot("TestRoot4");
>> IBytes bytes = new RandomAccessMemory( Constants.EEPROM_SIZE );
>> _map = E2MapBuilder.CreateMap( fileState.MapVersion,
>> bytes, Side.Right );
>> }
>>
>> [TestCase(1)] // Theory, what goes in comes out.
>> public void
>> ProfileConfigSavesAndRetrievesDefaultDaiIndex(int value)
>> {
>> ProfileConfig config = new ProfileConfig(_map);
>> config.DefaultDaiIndex = value;
>> Assert.That(config.DefaultDaiIndex, Is.EqualTo(value));
>> Assert.That( _map.GetInt(
>> MapConstants.REC_PROFILE_CONFIG, "DefaultDaiIndex" ),
>> Is.EqualTo( value ) );
>> }
>> }
>> }
>>
>> Now everything worked fine when this was just a Test, so it
>> has something to do with converting Test to TestCase(1)...
>> any thoughts?
>> Why would adding a parameter change the structural
>> requirements of my SetUp function?
>>
>> -Kelly
>>
>> --------------------------------------------------------------
>> -----------
>> This SF.Net email is sponsored by the Moblin Your Move
>> Developer's challenge Build the coolest Linux based
>> applications with Moblin SDK & win great prizes Grand prize
>> is a trip for two to an Open Source event anywhere in the
>> world http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> _______________________________________________
>> nunit-developer mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/nunit-developer
>>
>
>
>
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/