PowerShell/test/csharp
Andrew Schwartzmeyer dc9b4c595d Fix xUnit tests for Linux
The latest xUnit packages fix the "could not resolve coreclr path"
problem we were having. To resolve all dependencies, the cli-deps feed
was replaced with the aspnet feeds.

However, the latest xUnit packages do not allow us to set the default
AssemblyLoadContext.
2016-04-14 18:06:57 -07:00
..
fixture_AssemblyLoadContext.cs Programmatic update of core console host rename 2016-04-08 10:59:41 -07:00
project.json Fix xUnit tests for Linux 2016-04-14 18:06:57 -07:00
README.md Update test documentation 2016-04-04 19:20:26 -07:00
test_Binders.cs Add all classes to AssemblyLoadContext collection 2016-03-17 18:15:39 -07:00
test_CorePsExtensions.cs Add all classes to AssemblyLoadContext collection 2016-03-17 18:15:39 -07:00
test_CorePsPlatform.cs Fix xUnit tests 2016-04-08 15:22:37 -07:00
test_ExtensionMethods.cs Add all classes to AssemblyLoadContext collection 2016-03-17 18:15:39 -07:00
test_FileSystemProvider.cs Programmatic update of core console host rename 2016-04-08 10:59:41 -07:00
test_MshSnapinInfo.cs Add all classes to AssemblyLoadContext collection 2016-03-17 18:15:39 -07:00
test_PSVersionInfo.cs Add all classes to AssemblyLoadContext collection 2016-03-17 18:15:39 -07:00
test_Runspace.cs Programmatic update of core console host rename 2016-04-08 10:59:41 -07:00
test_SecuritySupport.cs Add all classes to AssemblyLoadContext collection 2016-03-17 18:15:39 -07:00
test_SessionState.cs Programmatic update of core console host rename 2016-04-08 10:59:41 -07:00
test_Utils.cs Add all classes to AssemblyLoadContext collection 2016-03-17 18:15:39 -07:00

xUnit Tests

These tests are completely Linux specific.

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.

Running xUnit Tests

Go to the top level of the PowerShell repository and run: Start-PSxUnit inside a self-hosted copy of PowerShell.