Judah
> A row provider is better than what I have to do now. I don't think
> it's ideal, because you're actually writing 2 methods now, 1 for the
> test, 1 for the row provider. However, even with [NonNull], we'd have
> to have a factory class/method. In an ideal world, I'd like to code
> this:
>
> [RowTest]
> [Row(null, new MyBar(), new MyFoo())]
> public void MyTest(...) { }
We could do something similar:
[RowTest]
[Row(null, typeof(MyBar), typeof(MyFoo())]
public void MyTest(object x, MyBar mb, MyFoo mf) { }
Then we could modify the RowTest to instantiate the type when the
corresponding parameter in the test method has the same type.
However this would be restricted to types that accept a public
parameterless constructor. Also consider how useful could these
objects be: what if you need to initialize them someway?
class A
{
public string X;
}
[RowTest]
[Row(typeof(A))]
public void MyTest(A a)
{
a.X.CompareTo("Ups"); // Null reference
}
The row provider method is the more flexible, but I like the idea of
having this and the MbUnitSpecialValue.Null implemented too.
> However, this is a limitation of the C# compiler (or of the CLR?). In
> my ideal world, I don't have to code up a separate method or class to
> do this. If there's any way that can be accomplished, we ought to do
> that.
The limitations change between compilers (VB2003 != VB2005 for
example), but I guess there must be limitations also in the CLR or the
assembly file format (at least the attributes parameter types should
be serializable). The following is taken from the C# specification
(4th Edition / June 2006):
<spec>
24.1.3 Attribute parameter types
The types of positional and named parameters for an attribute class
are limited to the attribute parameter types, which are:
- One of the following types: bool, byte, char, double, float,
int, long, short, string.
- The type object.
- The type System.Type.
- An enum type, provided it has public accessibility and the types
in which it is nested (if any) also have public accessibility.
- Single-dimensional arrays of the above types.
</spec>
What do you think?
Julián
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---