Hi Yann,

I think that .Web extension will be cool!

Well the attributes can be used for anything not just for the data
validation on MVC,
so I think it's possible to have some general asserts around that
outside the new extension.

For me I did two things, the first was to check if there is an
attribute on a property,
then I thought in the property that will have attributes like Range
for example,
because don't make sense just check if it exists or not
but it's necessary check the minimum and maximum.

The first idea is just like you said, Assert.HasAttribute will be
enough
and the second I couldn't figure out a nice name but it's something
that
you'll have basically the types (Model and *Attribute), property name
to check and
the last parameter could be a "Func" that you can check the properties
from the
Attribute.

Well, that was my idea, if you didn't understand anything I can
clarify, or if didn't like the idea I'll understand too.

Thanks,
Rafael

On 13 set, 03:29, Yann Trevin <[email protected]> wrote:
> Hi Rafael,
>
> There is no built-in assertion to do that yet :(
>
> In fact, an extension of MbUnit dedicated to web apps is
> foreseen<http://gallio.org/wiki/doku.php?id=mbunit:ideas>
>  (MbUnit.Framework.Web)
> That extension would ideally contain some useful assertions and helper
> features for technologies such as ASP.NET MVC.
> But I don't know precisely what would be worth to add in that extension...
>
> Otherwise if your requirements are more general, we could easily create a
> couple of assertions to work with attributes (e.g. Assert.HasAttribute or
> something)
>
> What sort of assertions would you need?
>
> Yann.
>
> 2010/9/10 Rafael <[email protected]>
>
>
>
> > Hi folks,
>
> > I was trying out the MbUnit Frameworks these days in an ASP.NET MVC 2
> > application and I wondering how to make an unit test for my models,
> > that uses data annotations for the validation.
>
> > I saw that there's isn't an assertion to check if some property is
> > "Required" for example. And I end up doing by the common way, but I
> > was wondering if these things can be added on the framework (I'm not
> > asking for nothing, just a suggestion) because we need to write some
> > considerable amount of code to check the attribute from a property
> > (even if its possible to create a separated method, like a helper to
> > do that).
>
> > Well, if I the framework provides something to check this kind of
> > thing, please show me, otherwise the suggestion is here!
>
> > Thanks!
>
> > --
> > 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]<mbunituser%2bunsubscr...@googlegrou 
> > ps.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/mbunituser?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.

Reply via email to