• .NET

    Future Mocking

    November 21, 2012 Share
    Mocking legacy code is hard. Especially, if it’s a third-party library and you have little control over how it’s written. It is even more difficult to unit test a type that is instantiated internally. One can argue that it should be refactored to accept dependencies via constructor injection.  However, constraints such as time, budget, experience with the offending code, or even access to the source often prevent paying down the technical debt accumulated in these legacy systems.   This post will show you how to mock an external library (concept) where it calls a login service class that cannot be sent...
  • .NET

    Mocking LINQ Queries

    November 02, 2012 Share
    Unit testing LINQ queries can be really challenging. This requires a deep knowledge of how LINQ queries work and how they filter results based on predicate values.  While I am adopting test first development approach, it is most likely that I want to verify the behavior of a query for correctness. In this post, I will show how easy it is to mock a LINQ query using JustMock for a given context. First, let me build up the context with a simple entity class for Employee that has two properties: Next, I created a dummy context that inherits the LINQ to SQL...
  • .NET

    Why I Hate Unit Testing

    So you went to work for the cool company that wooed you with promises of cutting edge technologies and techniques. In the interview, they told you that they are agile and unit test everything. You may or may not have been in an agile environment before, but the important thing you are enthusiastic about joining a team that truly gets software development. You tested on your previous job, even using JustMock to write better tests. You promise you can be agile yourself and quickly adopt their practices. You’re immediately hired. Many of you have been there… maybe you’re there right now. It takes...
  • .NET

    Mock. Just Mock. JustMock.

    It's my pleasure to announce the newest member of the Telerik product family – JustMock . We’re about to release the first beta of this new product on the 12th of April and the first official version is expected to be part of the Q2 release. Except JustMock, there’re some other big announcements we’re going to make on the 12th of April so please, stay tuned. This is just announcement 1/3. JustMock, as can be inferred from its name, is a mocking tool that will help you create better unit tests by making it easier for you to create mock objects (http://en.wikipedia.org/wiki/Mock_object)...