Hurrah! MVP for the seventh consecutive year!

After all these years, it's still an honor, a privilege ... and a few stressful days.

E-Reference Library Subscription Discount Offer for The Community

Microsoft Press has created an exclusive discount URL for the E-Reference Library that MVPs can pass along to the broader community without any limitations or restrictions.

To create a trial subscription, community referrals should use the Trial URL (

Any community referrals who subscribe to E-Reference Libraries through the Subscription URL ( will receive a 40% discount on a one-year subscription.

This discount offer ends on September 30, 2008.

Pedro Félix Is Blogging

Pedro Félix is blogging about WCF.

Techdays Portugal 2008 – For A World 2.0

Microsoft Portugal will be hosting Techdays 2008 from Mars 12nd to 14th, right after the Portuguese launch of Microsoft Visual Studio 2008, Microsoft SQL Server 2008 and Microsoft Windows Server 2008 on Mars 11th.

This is the biggest and greatest tech event in Portugal and there will be lots of national and international speakers and contests.

I'll be there. Come visit us.

TypeMock: How to Make Reflective Mocks More Natural

Like I said before, this as been on the back of my mind for a while.

A while back I introduced a way to get the MethodInfo of a method in a strongly typed way using LINQ, and that's how I'm going to make Reflective Mocks more Natural.

Well, it's as easy as this:

public static class MockExtender
public static IParameters ExpectAndReturn<T1, T2, TResult>(this IMockControl mock, Expression<Func<T1, T2, TResult>> expression, object ret, params Type[] genericTypes)
return mock.ExpectAndReturn((expression.Body as MethodCallExpression).Method.Name, ret, genericTypes);

(For now, I'll leave to someone else the implementation of the rest of the overloads)

With this implementation it's possible to handle static classes (a limitation of Fredrik's implementation).

As for private methods, just let Visual Studio (2008, in this sample) and TypeMock do their magic.

So, to test this class:

public static class Class1
public static string PublicMethod(string param1, int param2)
return PrivateMethod(param2, param1);

private static string PrivateMethod(int param2, string param1)
throw new NotImplementedException();

We just write this test:

public void PublicMethodTest()
string param1 = "param";
int param2 = 5;
string expected = "return";
string actual;

Mock targetMock = MockManager.Mock(typeof(Class1));

targetMock.ExpectAndReturn((int i, string s) => ClassLibrary1.Class1_Accessor.PrivateMethod(i, s), expected).Args(param2, param1);

actual = Class1.PublicMethod(param1, param2);

Assert.AreEqual(expected, actual);

How about this for clean and simple?

WCSF geekSpeak: Download Available At MSEVENTS

For those who missed my webcast (and wanted to watch it) it's available to download at the MSEVENTS site.

WCSF geekSpeak: Online Resources

Here is the list of topics covered in the WCSF geekSpeak webcast:

  1. Contextual Auto Complete Bundle
    Demo code: WCSF geekSpeak: Contextual Auto Complete Bundle Demo Code
  2. Validation Bundle
    Demo code: WCSF geekSpeak: Validation Bundle Demo Code
  3. Real-Time Search Bundle
    Demo code: WCSF geekSpeak: Real-Time Search Bundle Demo Code
  4. MVP Bundle
  5. Modularity Bundle
  6. Page Flow Application Block
  7. E-Commerce Catalog
  8. EventBroker extension

And here is a list of online resources:

WCSF geekSpeak: Real-Time Search Bundle Demo Code

This demo e based on the demo included in the Real-Time Search Bundle download.

The demo includes an entry form with two implementations:

  1. Using an Update Panel.

  2. Using the WCSF's Real-Time Search Monitor.

WCSF geekSpeak: Contextual Auto Complete Bundle Demo Code

This demo e based on the demo included in the Contextual Auto Complete Bundle download.

The demo includes an entry form with three implementations:

  1. Using the traditional auto post back model

  2. Using an update panel

  3. Using the Contextual Auto Complete Extender.

WCSF geekSpeak: Registration Open

There was a problem with the registration for this webcast, but it's now solved.