Use Setup Arguments with Moq

Published September 12th, 2011 Under Unit Testing | Leave a Comment

This tutorial shows how to use Setup parameters in the Returns of a mocked function using Moq. Moq (pronounced “Mock-you” or just “Mock”) is the only mocking library for .NET developed from scratch to take full advantage of .NET 3.5 (i.e. Linq expression trees) and C# 3.0 features (i.e. lambda expressions) that make it the most productive, type-safe and refactoring-friendly mocking library available.

Video source: http://thethoughtfulcoder.com/blog/52/Moq-Use-Setup-arguments-parameters-in-the-Returns-of-a-mocked-function

Mocks Suck (and what to do about it)

Published December 20th, 2010 Under Unit Testing | 1 Comment

Mock Objects caught the developer imagination when they were introduced to the world in 2000 and there are mock object frameworks for almost as many languages as there are testing frameworks. Many teams however discover too late the pain caused by using mock objects in their tests; brittle tests, an increasing lack of confidence in the tests and an inability to safely refactor. This talk explores the sources of pain caused by using mock objects and presents an alternative that is increasingly gaining in popularity.

Unit Testing Best Practices & Test Reviews

Published November 15th, 2010 Under Unit Testing | Leave a Comment

In this session we look at existing .NET code form open source projects and discuss anti patterns worst practices when doing unit testing in the wild. From abuse of mock objects, unmaintainable tests and unreadable tests to checking interactions vs. state – this talk will take you deep into the real ugly world of unit testing.

Watch this streaming video from the Norwegian Developer Conference 2010

Top 10 Mistakes in Unit Testing

Published September 6th, 2010 Under Unit Testing | 3 Comments

In this session we review the top 10 ways you can cause unit testing to fail to work for your project. From readability problems and lack of trust to mock object abuse and semi-integration testing – these gotchas can save you lots of time, sweat, and tears on your current and next projects.


Get Microsoft Silverlight

Download video in other formats and slides

The State of the Art on .NET

Published August 4th, 2010 Under Unit Testing | Leave a Comment

Amanda Laucher and Josh Graham present at an introductory level some of the most important elements of the .NET ecosystem: F#, M, Boo, NUnit, RhinoMocks, Moq, NHibernate, Castle, Windsor, NVelocity, Guerilla WCF, Azure, MEF.

http://www.infoq.com/presentations/The-State-of-the-Art-on-.NET

Moles: Mocking the Un-Mockable

Published April 26th, 2010 Under Unit Testing | Leave a Comment

In this episode we are going to take at how to use Pex and Moles for .Net. Unit testing is great, but most free isolation frameworks require that your mocks implement an interface. But what do you do when the class you are trying to mock is static or sealed with no interface. If you can’t modify the class then your unit testing efforts are usually stuck. Moles, the new free isolation framework from Microsoft, supports mocking almost any CLR based class (including sealed and static classes).

http://www.dimecasts.net/Content/WatchEpisode/170

Learning how to use Manual Mocks for Testing

Published March 1st, 2010 Under Software Testing, Unit Testing | Leave a Comment

In this episode we are going to take a look at how to use manual mocks for testing. Often times when creating unit tests we need to work in isolation in order to cover the paths we are attempting to test. When we want to test in isolation you can use a testing technique where you mock out your dependencies. When using Mocks you can either do it manually (what we are looking at) or you can use a mocking framework like Rhino Mocks. Either way you achieve the same results.

http://www.dimecasts.net/Content/WatchEpisode/164

keep looking »