question about test suites

"Jerry Shea" <[email protected]> Wed, 26 Nov 2008 21:31:23 +1100
Newsgroups gmane.comp.windows.dotnet.nunit.user
Message-ID <[email protected]>
--===============1960764706732758020==
Content-Type: multipart/alternative; 
	boundary="----=_Part_11964_12306459.1227695483863"

------=_Part_11964_12306459.1227695483863
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hi Everyone,

I'm trying to follow the instructions on the doco for
SuiteAttribute<http://www.nunit.org/index.php?p=suite&r=2.4.7>for
nunit
2.4.7. I copied the code to define the suite from that page and tried to
create a suite containing a customised instance of my test. I would expect
to see "xxxx" output to the console but instead "hello" is - my Suite
property is being ignored. Can anyone help?

Thx

namespace NunitSuiteTest {
    using System;
    using System.Collections;
    using NUnit.Framework;

    public class AllTests {
        [Suite]
        public static IEnumerable Suite {
            get {
                ArrayList suite = new ArrayList();
                suite.Add(new ATest("xxxx"));
                return suite;
            }
        }
    }

    [TestFixture]
    public class ATest {
        private string message = "hello";

        public ATest() { }
        public ATest(string m) {
            this.message = m;
        }

        [Test]
        public void Hello() {
            Console.WriteLine(message);
        }
    }
}

------=_Part_11964_12306459.1227695483863
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hi Everyone,<br><br>I&#39;m trying to follow the instructions on the <a href="http://www.nunit.org/index.php?p=suite&amp;r=2.4.7">doco for SuiteAttribute</a> for nunit <a href="http://2.4.7.">2.4.7.</a> I copied the code to define the suite from that page and tried to create a suite containing a customised instance of my test. I would expect to see &quot;xxxx&quot; output to the console but instead &quot;hello&quot; is - my Suite property is being ignored. Can anyone help?<br>
<br>Thx<br><br>namespace NunitSuiteTest {<br>&nbsp;&nbsp;&nbsp; using System;<br>&nbsp;&nbsp;&nbsp; using System.Collections;<br>&nbsp;&nbsp;&nbsp; using NUnit.Framework;<br><br>&nbsp;&nbsp;&nbsp; public class AllTests {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [Suite]<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public static IEnumerable Suite {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; get {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ArrayList suite = new ArrayList();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; suite.Add(new ATest(&quot;xxxx&quot;));<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return suite;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; [TestFixture]<br>
&nbsp;&nbsp;&nbsp; public class ATest {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; private string message = &quot;hello&quot;;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public ATest() { }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public ATest(string m) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this.message = m;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [Test]<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public void Hello() {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Console.WriteLine(message);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }<br>}<br><br>

------=_Part_11964_12306459.1227695483863--


--===============1960764706732758020==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

-------------------------------------------------------------------------
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=/
--===============1960764706732758020==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Nunit-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nunit-users

--===============1960764706732758020==--