Test if two IDictionary objects contain the same values
Your code doesn't work, because items in a dictionary aren't ordered in any way.

Example code that fails your test:

dictionary(
    new Dictionary&lt;int, int&gt; { { 0, 0 }, { 1, 1 } },
    new Dictionary&lt;int, int&gt; { { 1, 1 }, { 0, 0 } });


Some more notes about your code:

public static void dictionary(IDictionary pExpect, IDictionary pActual)


dictionary is a bad name for this method, because it doesn't really explain what it's supposed to do. Something like DictionaryEqualityTest would be better.

Also, I would avoid using the non-generic IDictionary if possible, IDictionary&lt;TKey, TValue&gt; would be better (though it would complicate the recursion).