This project is read-only.

Formatting of array argument

Mar 23, 2010 at 4:07 PM
Edited Mar 23, 2010 at 4:13 PM

Hi, thanks for a great framework. Is it possible to output the contents of any array arguments passed to a step?

 

 

new StoryQ.Story("")
    ...
    .WithScenario(...)
        .Given(MethodWithArrayArgument, new[] {1, 2, 3})
        .Execute();

 

 

Currently, this prints

"Given method with array argument(System.Int32[]) => Pending !!".

I think it would be better to print the contents of the array:

Given method with array argument([1, 2, 3]) => Pending !!

Is there already a way to do this? I've modified the ToStringParameterFormatAttribute.Format to work around the issue.

Coordinator
Mar 25, 2010 at 12:43 PM

This is a great idea. I think i'll handle IEnumerable as a special case within the ToStringParameterFormatAttribute. Care to share your code?

Coordinator
Mar 25, 2010 at 12:43 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Mar 29, 2010 at 2:25 PM

I'm a DVCS newbie, so bear with me. I've forked the project and applied my changes and sent a pull request now.

Coordinator
Mar 29, 2010 at 4:37 PM

Nice one - Thanks sukchr!

I got a notification of your pull request (fortunately it had instructions - i'm a bit of a DCVS newbie too) - we'll pull that ASAP.

Coordinator
Mar 30, 2010 at 7:41 AM

I had to add special handling for strings (since they implement IEnumerable). It's checked into changeset 96be79e4a68c, a release will come soon

Apr 11, 2010 at 11:58 AM
Great! Thank you for being so responsive!