Partial Class With NUnit

230 views
Skip to first unread message

siddhant agarwal

unread,
Feb 20, 2014, 4:59:35 AM2/20/14
to nunit-...@googlegroups.com
Is it possible to have a TestFixture as a partial class?
If Not, is there any other way around?

Marius Goppelt

unread,
Feb 20, 2014, 5:12:14 AM2/20/14
to nunit-...@googlegroups.com
Do you have a specific scenario in mind? Because partial classes are usually meant for code generators.

But generally:
Yes, it should work. Partial classes in .NET are afaik only a compiler issue, i.e. the compiled class doesn't "know" that it had been splitted.


Am Donnerstag, 20. Februar 2014 10:59:35 UTC+1 schrieb siddhant agarwal:

siddhant agarwal

unread,
Feb 20, 2014, 7:54:39 AM2/20/14
to nunit-...@googlegroups.com
Yes, actually I need to split the test cases for smaller modules under a bigger module into separate files and at the same time , around 70% of the logic used within the test cases of these smaller modules is common, only one or two arguments may vary.That's why, I was thinking of making my TestFixture  a partial class.

Tyrel Alastair Hunter

unread,
Feb 20, 2014, 7:56:17 AM2/20/14
to nunit-...@googlegroups.com
The compiler compiles partial classes into a single class. This will work

Sent from Mailbox for iPhone


--
You received this message because you are subscribed to the Google Groups "NUnit-Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nunit-discus...@googlegroups.com.
To post to this group, send email to nunit-...@googlegroups.com.
Visit this group at http://groups.google.com/group/nunit-discuss.
For more options, visit https://groups.google.com/groups/opt_out.

siddhant agarwal

unread,
Feb 20, 2014, 8:57:43 AM2/20/14
to nunit-...@googlegroups.com
I tried it and it worked perfectly without any problem..
Thanks
Reply all
Reply to author
Forward
0 new messages