Telerik blogs
  • Productivity Testing

    Unit testing LINQ to SQL

    Unit testing LINQ to SQL repositories can be very challenging. Unit testing such requires faking hard to mock classes and requires simulation to return your custom data for a particular LINQ statement. In this post, i will show how you can mock your LINQ repositories easily without much digging in. As,  i was goggling [my start page is bing, its a matter of time when i will be bing-ing :-)] around, found a nice post by Ronnie Holm, where he shows how to unit test a  LINQ to SQL repository. I will follow his trail and use some of the codes...
  • Productivity

    Fun with pointers in C#

    Disclaimer: this post is all about fun. It is not about: turning a bug into a feature; some new isolation/mocking practice; wow, look what I will do with pointers in my next project; It is all about fun :)
    July 19, 2010
  • Productivity

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

    [Want to see JustMock in action? Register for the free webinar this Thursday, Jul 22, 11 am EST and check out What’s New in JustCode, JustMock, and OpenAccess ORM. During the live event attendees will also have the chance to win a Telerik Ultimate Collection (valued at $1999).]   In JustMock. The tale continues... (Part 1) we saw how we can inject prologue/epilogue code in .NET methods with JustMock. We covered the most simplest scenarios and some more complex ones as methods with ref/out parameters. Today I will show you how to do code injections in generic methods. Basically there is nothing new. We are already familiar with: AtStartOfAction AtStartOfFunc AtEndOfAction AtEndOfFunc etc. and last time...
  • 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...
  • 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.
    July 09, 2010