From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Andrew Stopford
Sent: Tuesday, August 15, 2006 4:22 AM
To: [email protected]
Subject: MbUnit Re: RowTest and DateTime
Perhaps we could set up a facility to assist in deserializing values of custom datatypes more automatically. A couple of thoughts come to mind. (This aligns with the data-binding work I discussed in a previous email.)We would like to write the following.[RowTest][Row(new DateTime(2006, 12, 31))]public void DateTest(DateTime date) { ... }But we can't because DateTime is not one of the special constant types as far as the compiler is concerned. (GRRRR! Stupid restrictive languages!)But string and array constants are ok. So MbUnit could perform the type conversion for us. A little magic may go a long way. So we could write:[Row("2006/12/31")]public void DateTest(DateTime date) { ... }And MbUnit would know to convert the string to DateTime using Convert.ToDateTime or an equivalent (possibly extensible) mechanism before invoking the method. But it could also recognize object arrays as constructor arguments like this:[Row(new object[] { 2006, 12, 31 })]public void DateTest(DateTime date) { ... }With a little reflective magic it could locate the right DateTime constructor to invoke and pass in the arguments we specified.There are other variations we could consider here too...What do you think?Jeff.P.S. I'm seriously considering throwing together a comprehensive proposal for data-binding techniques and applications across the framework.
From: [email protected] [mailto: [email protected]] On Behalf Of Andrew Stopford
Sent: Monday, August 14, 2006 2:45 AM
To: [email protected]
Subject: MbUnit Re: RowTest and DateTime
Hi Phil,Faries ran off with my brain on this one again. I suspect that it's really the one way you can do this.AndyOn 8/12/06, Phil Winstanley <[EMAIL PROTECTED]> wrote:Here's how I ended up getting round the Constants required for Row values…
[RowTest()]
[Row(1, 1, null, ExpectedException = typeof(BLAH))]
[Row(1, 2, ("01 Jan 2006"))]
[Row(1, 3, ("01 Jan 1900"))]
[Row(1, 4, ("01 Jan 2050"), ExpectedException = typeof (BLAH))]
public void BLAH (int OneId, int TwoId, string OneDate)
{
DateTime myDate = Convert.ToDateTime(OneDate);
Assert.IsTrue(true);
}
Is that the right way to do it? Is there a better way?
From: [email protected] [mailto:[email protected]] On Behalf Of Andrew Stopford
Sent: 10 August 2006 23:53
To: [email protected]
Subject: MbUnit Re: RowTest and DateTime
Hi Phil,
I asume you mean the date type, you should be ok to use this type directly. Let me know how you get on.
Andy
On 8/10/06, Plip <[EMAIL PROTECTED]> wrote:
Just a quick question, should I pass DateTimes into my RowTests are
strings and then convert them to DateTimes once they get in there?
Thanks,
Phil.
--------------------------
received to: andyb.com
Message ID : o035526f9e13f4979a82f03c48cb4b067.pro
Sender ID : [EMAIL PROTECTED]
Msg Size : 2k
------------------------------------------------------------------------
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they are
addressed.
If you have received this email in error please notify the originator of
the message. This footer also confirms that this email message has been
scanned for the presence of computer viruses, though it is not
guaranteed virus free.
Original Recipient: [email protected]
Original Sender : [EMAIL PROTECTED]
Original Send Date: 12/08/2006 - 11:50:48
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
- MbUnit Re: RowTest and DateTime Jeff Brown
- MbUnit Re: RowTest and DateTime Andrew Stopford
- MbUnit Re: RowTest and DateTime Jeff Brown
- MbUnit Re: RowTest and DateTime Andrew Stopford
Reply via email to
