Hi,

   I would like to know if there is a workaround on setting the CSV
path attribute from an config file?
   Let me explain with an example :

   public class Person
    {
        [CsvData(FilePath = Config.getCsvPerson() , HasHeader = true)]
        public Person(string name) {  }
    }


   If I currently run this I get the following compilation error :
   An attribute argument must be a constant expression, typeof
expression or array creation expression

Thank you


On Feb 7, 5:09 am, "Jeff Brown" <[email protected]> wrote:
> On the fixture class.
>
> But it should also work on the constructor as well as on the constructor
> parameter.  It can also be used on fields and properties as well as
> individual test methods!
>
> Jeff.
>
>
>
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On
>
> Behalf Of max2256
> Sent: Monday, February 02, 2009 5:26 AM
> To: MbUnit.User
> Subject: MbUnit Re: CsvData problem
>
> What do you mean by putting it on the type?
>
> On Jan 31, 4:03 pm, Jeff Brown <[email protected]> wrote:
> > That's a bug.  We should be able to apply the attribute to the
> > constructor.  However, try putting it on the type instead.
>
> > On Jan 29, 2009, at 2:35 PM, max2256 <[email protected]> wrote:
>
> > > Hi
>
> > > I have the following values in my csv file
>
> > > firstName,LastName,age
> > > Jim,Morrison,40
> > > Pat,King,25
>
> > > Now let's say I want to use the CsvData attribute this way:
>
> > > public class PersonTest
> > > {
> > >     private Person p;
>
> > >     [CsvData(FilePath = "Persons.csv", HasHeader = true)]
> > >     public PersonTest( string fName, string lName, int age )
> > >     {
> > >          p = new Person(fName,lName,age);
> > >     }
> > > }
>
> > > I've noticed that it is not possible to use le CsvData attribute at
> > > the constructor level, the only way of achieving this is with the
> > > following :
>
> > >   public PersonTest( [CsvData(FilePath = "Persons.csv", HasHeader =
> > > true)] string fName, string lName, int age )
>
> > > My question is how can I get the lName and age value if I only put
> > > the CsvData attribute only on the first parameter ?
>
> > > Thanx- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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