Telerik blogs
  • Productivity

    JustMock. The tale continues... (Part 1)

    Last time we talked about how to inject code at the beginning of a method. Today I will post how to inject code at the end of a method and I will cover some more complex scenarios as well. So lets start with sample program and then I will explain it in details. using System; using Telerik.CodeWeaver.Hook;   namespace ConsoleApplication2 {     sealed class MyClass     {         public void SayHello() { Console.WriteLine("Hello!"); }           public int SayHello(string name)         {             Console.WriteLine("Hello {0}!", LastName = name);             return (name ?? string.Empty).Length;         }           public string LastName { get; set; }           public int Increment10(ref int...
    May 27, 2021 6 min read
  • Web

    Calling a method of a base class' base class

    Yesterday a colleague of mine asked me a question about how to invoke a method of a base class' base class. Although it is possible it is not a good idea.
    May 27, 2021 1 min read
  • Productivity Testing

    JustMock. Not just mock. A tale about duality.

    As JustMock is approaching its release date I decided to blog about it and more precisely about its dual nature. Probably you already know JustMock supports two (proxy and elevated) modes. That's why I am speaking about duality. In fact the duality in JustMock has many aspects. We could even say JustMock was built on two continents as one of the brains behind JustMock is working remotely on the project. So, duality is everywhere :) By the way, check out Mehfuz's blog, it is excellent place where you can see JustMock in action. I've been thinking for some time about doing...
    May 27, 2021 7 min read
  • Web ASP.NET MVC

    Hands on mocking of ASPNETMVC controller action

    In this post, I will start with an MVC sample created from the default template project that is bundled with ASPNET MVC2 installation. This template provides not just a dummy project with folder organized but rather a full running app.
    May 27, 2021 3 min read
  • Productivity

    Mocking the File System to Improve Testability (with JustMock)

    Many applications require access to the file system to create, modify or delete files and folders. But how do you make sure that such application behaves correctly? You do it with tests of course but there is a catch: In general it is not a good idea to have tests that are performing Input/Output operations like accessing files and databases. When you need to test I/O operations mock objects are your friend. And before I go into more details let me point out some of the benefits of mocking. Usually faster than performing I/O operations You do not have have to deal...
    May 27, 2021 5 min read