1 / 10

Rhino Mocks 3.5

Rhino Mocks 3.5. Oren Eini / Ayende Rahien ayende@ayende.com http://www.ayende.com/Blog/. Standard Testing. [Test] public void TwoPlusTwo_Equal_Four () { var result = new Calculator().Add(2,2) Assert.AreEqual (4, result, “Math is broken” ); }. We aren’t writing calculators.

terra
Télécharger la présentation

Rhino Mocks 3.5

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Rhino Mocks 3.5 Oren Eini / AyendeRahien ayende@ayende.com http://www.ayende.com/Blog/

  2. Standard Testing [Test] public void TwoPlusTwo_Equal_Four() { var result = new Calculator().Add(2,2) Assert.AreEqual(4, result, “Math is broken”); }

  3. We aren’t writing calculators

  4. Interactions • No state to test? • ExecuteCommand • SendSms • Complex collaborations • Get user from repository, if has phone, send SMS, otherwise, log error and send email.

  5. Objects don’t work in isolation But we want to test them this way

  6. A bit of history • When testing, we want: • Arrange • Act • Assert • When mocking, we had to: • Expect • Act • Verify • Not anymore

  7. People, I need a scenario… • And let us make it a real one. • I am tired of writing calculators and bowling games

  8. Demo

  9. A few words of caution Avoid over specified tests Test only one thing Use Inversion of Control Container and Auto Mocking Container when complexity grows.

  10. Questions

More Related