• .NET

    JustCode Code Style Settings for C#, Part 1

    November 16, 2012 Share
    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...
  • .NET

    Automocking with JustMock

    November 07, 2012 Share
    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...
  • .NET

    JustCode Q3 Typing Assistance Improvements

    November 05, 2012 Share
    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...
  • .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

    Abstracting Dependencies with JustMock

    October 31, 2012 Share
    Unit tests are most effective when the System Under Test is isolated from its dependencies.  The best way to isolate your code (and make your code more SOLID) is through dependency injection. But even if you follow the rules of SOLID and inject all of the necessary dependencies in as interfaces, you are still faced with the fact that you depend on them. In order to test your code, something concrete has to be passed into the code in order for it to even compile.  Your production code will most likely use a factory to create concrete instances of the dependent interfaces, but that...