Tag: Moq

  • How can I unit test unsubscribing from an event? (C#)

    I’ve seen some strange bugs that occur when you don’t properly unsubscribe from events. But it seems I’m always stuck when it comes to unit testing that. Well, I use Moq for most of my mocking and there are some techniques you can use for testing that your subscribed, namely by Raise(ing) the event in…

  • MVC Team Should Rule

    Headline: I don’t think I’ve seen a team more focused on testability at Microsoft than the ASP.NET MVC (Model-View-Controller) team. I sure hope their unit testing philosophy starts to influence other teams more. Entity Framework If you use any of the patterns for the Entity Framework (one of the early versions of .NET 4.0 that…

  • Unit Testing CodeSmith Insight

    Technorati Tags: Unit Testing,MVC,Moq,CodeSmith,Insight As anyone that knows me knows, I use test driven development. So when I put together a Feedback page in my MVC (Model-View-Controller) site I started with my test. What should the test be? Let’s start with the User Story : As a site user (anonymous or logged in) I want…

  • Testing HtmlHelper in MVC 2 RC 2

    Technorati Tags: MVC,TDD,Mock,Moq I strive to use TDD (Test Driven Development) so not having unit tests drives me crazy. I was so pleased to run across this post http://ox.no/posts/mocking-htmlhelper-in-aspnet-mvc-rc1-using-moq making it easy for me to unit test the Html Helper. But then I downloaded the MVC 2 RC 2 and all my unit tests for…