Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>A lot of the unit tests for the F# Visual Studio components are written in F#. They run outside VS, mocking the various Visual Studio bits. The ability to cons up anonymous objects that implement interfaces is useful in place of a mocking framework/tool. I can just write</p> <pre><code>let owpe : string list ref = ref [] let vsOutputWindowPane = { new IVsOutputWindowPane with member this.Activate () = err(__LINE__) member this.Clear () = owpe := []; 0 member this.FlushToTaskList () = VSConstants.S_OK member this.GetName(pbstrPaneName) = err(__LINE__) member this.Hide () = err(__LINE__) member this.OutputString(pszOutputString) = owpe := pszOutputString :: !owpe ; 0 member this.OutputStringThreadSafe(pszOutputString) = owpe := pszOutputString :: !owpe ; 0 member this.OutputTaskItemString(pszOutputString, nPriority, nCategory, pszSubcategory, nBitmap, pszFilename, nLineNum, pszTaskItemText) = err(__LINE__) member this.OutputTaskItemStringEx(pszOutputString, nPriority, nCategory, pszSubcategory, nBitmap, pszFilename, nLineNum, pszTaskItemText, pszLookupKwd) = err(__LINE__) member this.SetName(pszPaneName) = err(__LINE__) } DoSomethingThatNeedsA(vsOutputWindowPane) assert( !owpe = expectedOutputStringList ) </code></pre> <p>when I need an instance of e.g. an <code>IVsOutputWindowPane</code> to pass to some other component that will eventually be calling <code>OutputString</code> and <code>Clear</code>, and then inspect the <code>string list ref</code> object at the end of the test to see if the expected output was written. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload