Skip to content

Step type is now prepended onto step title.#138

Merged
MehdiK merged 3 commits intoTestStack:masterfrom
JakeGinnivan:PrependSteps
May 7, 2014
Merged

Step type is now prepended onto step title.#138
MehdiK merged 3 commits intoTestStack:masterfrom
JakeGinnivan:PrependSteps

Conversation

@JakeGinnivan
Copy link
Member

Fixes #121

@JakeGinnivan
Copy link
Member Author

Also tested with the new sample I had written:

        this.Given(_ => TheBuyerIsA(_buyerCategory))
            .And(_ => TheBuyerSelectsA(fare))
            .When(_ => TheBuyerPays())
            .Then(_ => ASaleOccursWithAnAmountOf(Price))
            .WithExamples(new ExampleTable(
                "Buyer Category", "Fare", "Price")
            {
                {BuyerCategory.Student, new MonthlyPass(), new Money(76)},
                {BuyerCategory.Senior, new MonthlyPass(), new Money(98)},
                {BuyerCategory.Standard, new MonthlyPass(), new Money(146)},
                {BuyerCategory.Student, new WeeklyPass(), new Money(23)},
                {BuyerCategory.Senior, new WeeklyPass(), new Money(30)},
                {BuyerCategory.Standard, new WeeklyPass(), new Money(44)},
                {BuyerCategory.Student, new DayPass(), new Money(4)},
                {BuyerCategory.Senior, new DayPass(), new Money(5)},
                {BuyerCategory.Standard, new DayPass(), new Money(7)},
                {BuyerCategory.Student, new SingleTicket(), new Money(1.5m)},
                {BuyerCategory.Senior, new SingleTicket(), new Money(2m)},
                {BuyerCategory.Standard, new SingleTicket(), new Money(3m)}
            })
            .BDDfy("Successful rail card purchases");

Results in:

Scenario: Successful rail card purchases
    Given the buyer is a <Buyer Category>       
      And the buyer selects a <Fare>            
    When the buyer pays                         
    Then a sale occurs with an amount of <Price>

Examples: 
| Buyer Category | Fare         | Price   |
| Student        | Monthly Pass | $76.00  |
| Senior         | Monthly Pass | $98.00  |
| Standard       | Monthly Pass | $146.00 |
| Student        | Weekly Pass  | $23.00  |
| Senior         | Weekly Pass  | $30.00  |
| Standard       | Weekly Pass  | $44.00  |
| Student        | Day Pass     | $4.00   |
| Senior         | Day Pass     | $5.00   |
| Standard       | Day Pass     | $7.00   |
| Student        | Day Pass     | $1.50   |
| Senior         | Day Pass     | $2.00   |
| Standard       | Day Pass     | $3.00   |

I figure there were a few tests which caught the change and the fix was to do what you would expect. Or do you think we need another few tests?

@MehdiK
Copy link
Member

MehdiK commented May 6, 2014

This is nice. I think we need to add unit tests for the additions. And when seems to be covered with existing tests; but we need to add tests for others too.

@JakeGinnivan
Copy link
Member Author

Added a test

@MehdiK
Copy link
Member

MehdiK commented May 6, 2014

The test seems broken (didn't check the details).

@JakeGinnivan
Copy link
Member Author

Test being inlined i think... will add the no inlining attribute

@JakeGinnivan JakeGinnivan added this to the V4 milestone May 7, 2014
@JakeGinnivan
Copy link
Member Author

Rebased

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I didn't realize you could chain Givens! It's good it's supported for when it's needed. Also compatible with Cuke.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, you MUST start with a Given or a When (if you start with When you can't use nSubstitute 👎) but after that you can use any of the extensions :)

MehdiK added a commit that referenced this pull request May 7, 2014
Step type is now prepended onto step title.
@MehdiK MehdiK merged commit 01e21aa into TestStack:master May 7, 2014
@MehdiK
Copy link
Member

MehdiK commented May 7, 2014

I really like this addition. Fluent API is A LOT easier than before and reflective API to use.

Fluent API FTW reflective suckers ;) cc @mwhelan

@JakeGinnivan JakeGinnivan deleted the PrependSteps branch May 7, 2014 19:21
@JakeGinnivan
Copy link
Member Author

:trollface:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Prepend And/But to title

2 participants