Telerik blogs
  • Productivity

    Future Mocking

    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...
    November 21, 2012
  • Productivity

    JustCode Code Style Settings for C#, Part 1

    In our previous blog posts on the JustCode Formatter, we’ve showed you what it is and how it works. If you haven’t read those yet, please see our post on "Introducing the Formatter" and "Comparing the JustCode Formatter to the Visual Studio Formatter". One of our design goals was to make sure the Formatter is much more customizable than Visual Studio’s, and in this post, we will show you how easy it is to customize it. What are the Code Style settings? When you utilize JustCode’s refactorings, expand code templates, format and/or clean your code, or make other changes to your code, JustCode...
    November 16, 2012
  • Productivity Testing

    Automocking with JustMock

    Auto mocking containers are designed to reduce the friction of keeping unit test beds in sync with the code being tested as systems are updated and evolve over time. Background The Dependency Inversion Principle states: High level modules should not depend upon low level modules. Both should depend upon abstractions. Abstractions should not depend upon details. Details should depend upon abstractions. As more developers follow this and the rest of Robert Martin’s SOLID principles, methods and classes become much smaller with dependent objects injected into them, typically through constructor injection. As additional dependencies are needed (or the code is refactored to improve dependency isolation), the signatures of...
    November 07, 2012
  • Release

    JustCode Q3 Typing Assistance Improvements

    We designed the typing assistance feature of JustCode to increase your productivity by saving you keystrokes without getting in your way. In this release, we enhanced this feature, making it faster and better than ever. Brace positioning When you press enter between opening and closing brace, JustCode positions the braces correctly and inserts an empty line so you can begin typing immediately. Previously, JustCode used the formatting feature to position braces correctly, and this was sometimes slow. The brace positioning no longer relies on the formatter, and the result is extremely fast. Wrap statement in braces When you add an open brace at the beginning of...
    November 05, 2012
  • Productivity

    Mocking LINQ Queries

    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...
    November 02, 2012