urasandesu / Prig

Prig is a lightweight framework for test indirections in .NET Framework.
Other
117 stars 21 forks source link

Does prig support xunit? #75

Closed esenpillai closed 8 years ago

esenpillai commented 8 years ago

Please refer my attached sample project in xunit. Not sure what am I doing wrong and why is it not working. I debugged it and the call is still going through real implementation not through fake implementation. TestPrig1.zip

Nevermind, found the issue, I was trying to test this on resharper test explorer window. It appears this works on xunit.visualstudio.runner test explorer. I can't close this, ticket. Please close this ticket.

I successfully added and finished my fake, and unit test using this. We were about to upgrade VS 2015 professional to premium edition to get microsoft fakes. This saved us a lot, I recommended my manager to contribute donation to your work. Thanks for your quick support and appreciate your work.

urasandesu commented 8 years ago

It seems that you want to use xUnit.net [Runner: Console] instead of xUnit.net [Runner: Visual Studio]. That takes a little labor, but you can fake the real implementation sure. Please try the following steps:

Preparation: Install xUnit.net [Runner: Console] as a target packages of Prig

Run Visual Studio as Administrator. In the Package Manager Console, move the current directory to your TestPrig.sln directory and execute the following command:

PM> prig install xunit -source (Resolve-Path .\packages\xunit.runner.console.*\tools).Path

NOTE: This step is needed only one time.

Execute xUnit.net [Runner: Console] under Prig

Run Visual Studio(Administrator access is unnecessary). In the Package Manager Console, move the current directory to your TestPrig.sln directory and execute the following command:

PM> $env:URASANDESU_PRIG_CURRENT_DIRECTORY = (Resolve-Path .\TestPrig\bin\Debug).Path
PM> $env:URASANDESU_PRIG_TARGET_PROCESS_NAME = "xunit.console"
PM> prig run -process (Resolve-Path .\packages\xunit.runner.console.*\tools\xunit.console.exe).Path -arguments ".\TestPrig\bin\Debug\TestPrig.dll"

Please see also the other documents that describe them; Command Line Reference: Installer/Runner options, AppVeyor Support: Create Test Script and Profilers Chain sample.

urasandesu commented 8 years ago

I successfully added and finished my fake, and unit test using this.

I'm glad to hear that you have resolved the issue :smile: Please contact me whenever you'd like to ask us anything.