I was hoping someone else might have an idea :)
I don't think it's possible, is the short answer. The compiler won't allow
it. (I could be wrong though, I often am!).
It's quite common to offer a non-generic overload that takes a type as a
parameter, which would allow you test the important details:
[Test]
[Row(typeof(string))]
[Row(typeof(int))]
public void Generic_parameterised_test(Type type)
{
NonGenericMethod(type);
}
public void GenericMethod<T>()
{
NonGenericMethod(typeof(T));
}
public void NonGenericMethod(Type type)
{
Console.WriteLine("Called with T: {0}", type.FullName);
}
On 20 December 2011 14:09, Nick Portelli <[email protected]> wrote:
> I asked this in mbunit group, but that one doesn't seem visited often.
> I'm guessing if possible it has to do with some of the attributes, like
> [Row] or something. I figured out the pairwise attribute and that's
> awesome. One thing I've noticed is the lack of examples in documentation
> and wiki. If I understood I'd help populate that. (if wanted). Any way is
> there a simple example oh how to test a generic method?
>
> It just dawned on my I may be trying to test that incorrectly. Either way
> some insight would be great.
>
> --
> You received this message because you are subscribed to the Google Groups
> "gallio-user" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/gallio-user/-/2pCGlTsCrzEJ.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/gallio-user?hl=en.
>
--
You received this message because you are subscribed to the Google Groups
"MbUnit.User" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/mbunituser?hl=en.