2012-08-24 4 views
5

Ich habe eine statische Methode mit ref-Parametern in meiner alten (nicht testbaren) DLL. Ich versuche Komponententests für eine Klasse zu schreiben, die diese Methode aufruft.Verwenden von Microsoft-Fehlern, um eine Methode mit ref-Parametern zu shimmen

public static class Branding 
{ 
    ... 
    ... 

    static public bool GetBranding(Int32 providerId, 
     Int32 employerId, 
     string brandingElement, 
     ref string brandingValue) 

    ... 
    ... 
} 

Ich brauche Hilfe eine Shim Erklärung für diesen Aufruf

ShimBranding.GetBrandingInt32Int32StringStringRef = 
    (providerId, employerId, element, { ====> WHAT GOES HERE <===== }) 
    => 
    true; 

Dank zu schreiben!

Antwort

16
using (ShimsContext.Create()) 
{ 
    ShimBranding.GetBrandingInt32Int32StringStringRef = 
     (int providerId, int employerId, string brandingElement, ref string brandingValue) => 
     { 
      brandingValue = "Blah"; 
      return true; 
     }; 
}