This project is read-only.

ArgumentException: Underscores in Method names

Jul 4, 2010 at 6:50 AM

Why does StoryQ throw an exception when I use underscores in my method names?





The exception thrown is:

Test method DemoTests.UnitTest1.TestMethod1 threw exception: System.ArgumentException: If you use 6 underscores in your method name, make sure there's 6 arguments (found 0)

Jul 5, 2010 at 7:47 AM

This is because the underscore is a placeholder for an argument; this allows StoryQ know where your arguments were in the original text.

For example,

If you have the statement Given(MyNameIs_AndMyAgeIs_, "John", 20), you could write a method with the name MyNameIsAndMyAgeIs(string name, int age), and StoryQ would pass the values "John" and "20" to your method.

In this case, when Story produces its report you will get text thats written back into the underscore placeholders, i.e. Given My name is John and My Age Is 20.