2016-04-05 04:20:26 +02:00
|
|
|
xUnit Tests
|
|
|
|
===========
|
2016-03-18 02:20:05 +01:00
|
|
|
|
2016-03-31 00:42:16 +02:00
|
|
|
These tests are completely Linux specific.
|
2016-03-18 02:20:05 +01:00
|
|
|
|
|
|
|
Every test class *must* belong to
|
|
|
|
`[Collection("AssemblyLoadContext")]`. This ensures that PowerShell's
|
|
|
|
AssemblyLoadContext is initialized before any other code is executed.
|
|
|
|
When this is not the case, late initialization fails with
|
|
|
|
`System.InvalidOperationException : Binding model is already locked
|
|
|
|
for the AppDomain and cannot be reset.`
|
|
|
|
|
|
|
|
Having every class in the same collection is as close to an xUnit
|
|
|
|
global init hook as can be done.
|
2016-04-05 04:20:26 +02:00
|
|
|
|
|
|
|
Running xUnit Tests
|
|
|
|
-------------------
|
|
|
|
|
|
|
|
Go to the top level of the PowerShell repository and run:
|
|
|
|
`Start-PSxUnit` inside a self-hosted copy of PowerShell.
|