SuiteAttribute & generics

"Nassar, Anthony" <[email protected]>
Newsgroups gmane.comp.windows.dotnet.nunit.user
Message-ID <[email protected]>
I think I know the answer to this (it's "No!"), but I'd like to make
sure. There is currently no way to create suites (or something similar)
of instantiated generic classes without declaring those instantiations
explicitly, right? I don't know if I've expressed this correctly, so
I'll give an example. I'd like to declare a generic test fixture, then
programmatically instantiate it for particular classes and add it to the
test run. Here's what I have to do now... 

 

namespace Blah {

[TestFixture]

public class TestSerializability<T> where T : new()

{

private BinaryFormatter formatter;

private Stream stream;

 

[TestFixtureSetUp]

public void OpenStream()

{

formatter = new BinaryFormatter();

stream = Stream.Null;

}

 

[TestFixtureTearDown]

public void CloseStream()

{

stream.Close();

}

 

[Test]

public void TestObject()

{

formatter.Serialize(stream, new T());

}

}

 

public class TestOmegaNodeSerializability :
TestSerializability<OmegaNode>

{

}

 

public class TestOmegaLinkSerializability :
TestSerializability<OmegaLink>

{

}

 

public class TestOmegaDocSerializability : TestSerializability<OmegaDoc>

{

}

}

________________________________

Tony Nassar

Cell: (703) 994-0954

Blog: http://slideguitarist.blogspot.com/
<blocked::http://slideguitarist.blogspot.com/> 
Music: http://www.soundclick.com/thecompletists
<http://www.soundclick.com/thecompletists> 

"God love me, and I'm a hell of a fighter.." - Floyd Mayweather

-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4

_______________________________________________
Nunit-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nunit-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.