This project is read-only.

Complete support for byref arguments


We are mocking Visual Studio SDK API which involves a lot of calls with byref arguments (both in and out). Using SetupByName isn't enough since there might be multiple overloads, and these calls might be in a C# project. We tried
let documentFactoryService = 
            .Calls<ITextBuffer * byref<ITextDocument>>(fun (textBuffer, textDocument) ->
                    textBuffer.Properties.TryGetProperty(typeof<ITextDocument>, &textDocument))
but F# compiler doesn't like byref arguments inside quotations (see for a few examples).

Sometimes I'm able to use SetUpByName and return tuples, but Foq code generation crashes NUnit test runners.

We have a few examples involving byref arguments e.g. so that you know what usage we are looking for. We would love to be able to replace these handwritten object expressions by Foq calls. Their uses are in


ptrelford wrote Aug 12, 2014 at 9:09 AM

The latest change set includes initial support for passing byref args as values to Calls via SetupByName.

dungpa wrote Aug 12, 2014 at 5:24 PM

It would be great if you can live debug on our examples above. It might be more tricky than examples in current test cases.