BDD on Steroids


In the last couple of weeks I had a chance to sprinkle some of JP’s syntactic sugar, all over my projects. It’s amazing how much more concise my units test have become. I’ve had a couple of issues where I was mocking out the behavior of some Win Forms controls, but for the most part it’s been an awesome experience!

I just wanted to take a moment to say Thank you JP! I am enjoying using your BDD (on steroids) extensions. If you haven’t already you need to check it out here… NOW!

Maaad, maaaad props Mr. JP!

 

   10     public class behaves_like_save_changes_view_bound_to_presenter : concerns_for<SaveChangesView>

   11     {

   12         context c = () => { presenter = an<ISaveChangesPresenter>(); };

   13 

   14         because b = () => sut.attach_to(presenter);

   15 

   16         static protected ISaveChangesPresenter presenter;

   17     }

   18 

   19     public class when_the_save_button_is_clicked : behaves_like_save_changes_view_bound_to_presenter

   20     {

   21         it should_forward_the_call_to_the_presenter = () => presenter.was_told_to(x => x.save());

   22 

   23         because b = () => EventTrigger.trigger_event<Events.ControlEvents>(

   24                               x => x.OnClick(new EventArgs()),

   25                               sut.ux_save_button

   26                               );

   27     }

   28 

   29     public class when_the_cancel_button_is_clicked : behaves_like_save_changes_view_bound_to_presenter

   30     {

   31         it should_forward_the_call_to_the_presenter = () => presenter.was_told_to(x => x.cancel());

   32 

   33         because b = () => EventTrigger.trigger_event<Events.ControlEvents>(

   34                               x => x.OnClick(new EventArgs()),

   35                               sut.ux_cancel_button

   36                               );

   37     }

   38 

   39     public class when_the_do_not_save_button_is_clicked : behaves_like_save_changes_view_bound_to_presenter

   40     {

   41         it should_forward_the_call_to_the_presenter = () => presenter.was_told_to(x => x.dont_save());

   42 

   43         because b = () => EventTrigger.trigger_event<Events.ControlEvents>(

   44                               x => x.OnClick(new EventArgs()),

   45                               sut.ux_do_not_save_button

   46                               );

   47     }

</p>
Data-Driven Services with Silverlight 2